1
0
mirror of https://github.com/danog/MadelineProto.git synced 2025-01-22 18:51:13 +01:00

Revert back some wrong changes ...

This commit is contained in:
Mahdi 2023-09-02 16:34:21 +03:30
parent c7b222ed78
commit 008ccd9c79
5 changed files with 8 additions and 8 deletions

View File

@ -73,13 +73,13 @@ final class PostgresArray extends PostgresArrayBytea
{
$this->serializer = match ($serializer) {
SerializerType::SERIALIZE => fn ($v) => \bin2hex(\serialize($v)),
SerializerType::IGBINARY => fn ($v) => \bin2hex(igbinary_serialize($v)),
SerializerType::IGBINARY => fn ($v) => \bin2hex(\igbinary_serialize($v)),
SerializerType::JSON => fn ($v) => \bin2hex(\json_encode($v, JSON_THROW_ON_ERROR|JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES)),
SerializerType::STRING => fn ($v) => \bin2hex(\strval($v)),
};
$this->deserializer = match ($serializer) {
SerializerType::SERIALIZE => fn ($v) => \unserialize(\hex2bin($v)),
SerializerType::IGBINARY => fn ($v) => igbinary_unserialize(\hex2bin($v)),
SerializerType::IGBINARY => fn ($v) => \igbinary_unserialize(\hex2bin($v)),
SerializerType::JSON => fn ($value) => \json_decode(\hex2bin($value), true, 256, JSON_THROW_ON_ERROR),
SerializerType::STRING => fn ($v) => \hex2bin($v),
};

View File

@ -91,7 +91,7 @@ class PostgresArrayBytea extends SqlArray
{
$this->serializer = match ($serializer) {
SerializerType::SERIALIZE => fn ($v) => new ByteA(\serialize($v)),
SerializerType::IGBINARY => fn ($v) => new ByteA(igbinary_serialize($v)),
SerializerType::IGBINARY => fn ($v) => new ByteA(\igbinary_serialize($v)),
SerializerType::JSON => fn ($v) => new ByteA(\json_encode($v, JSON_THROW_ON_ERROR|JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES)),
SerializerType::STRING => fn ($v) => new ByteA(\strval($v)),
};

View File

@ -70,7 +70,7 @@ final class WebRunner extends RunnerAbstract
'cwd' => Magic::getcwd(),
'MadelineSelfRestart' => 1
];
if (\function_exists('memprof_enabled') && memprof_enabled()) {
if (\function_exists('memprof_enabled') && \memprof_enabled()) {
$params['MEMPROF_PROFILE'] = '1';
}

View File

@ -1757,13 +1757,13 @@ final class MTProto implements TLCallback, LoggerGetter
if (!\extension_loaded('memprof')) {
throw Exception::extension('memprof');
}
if (!memprof_enabled()) {
if (!\memprof_enabled()) {
throw new Exception("Memory profiling is not enabled, set the MEMPROF_PROFILE=1 environment variable or GET parameter to enable it.");
}
$current = "Current memory usage: ".\round(\memory_get_usage()/1024/1024, 1) . " MB";
$file = \fopen('php://memory', 'r+');
memprof_dump_pprof($file);
\memprof_dump_pprof($file);
\fseek($file, 0);
$file = [
'_' => 'inputMediaUploadedDocument',

View File

@ -140,7 +140,7 @@ final class SessionPaths
.\chr(PHP_MAJOR_VERSION)
.\chr(PHP_MINOR_VERSION)
.\chr(Magic::$can_use_igbinary ? 1 : 0)
.(Magic::$can_use_igbinary ? igbinary_serialize($object) : \serialize($object));
.(Magic::$can_use_igbinary ? \igbinary_serialize($object) : \serialize($object));
write(
"$path.temp.php",
@ -198,7 +198,7 @@ final class SessionPaths
$headerLen++;
}
$unserialized = $file->read(null, $size - $headerLen) ?? '';
$unserialized = $igbinary ? igbinary_unserialize($unserialized) : \unserialize($unserialized);
$unserialized = $igbinary ? \igbinary_unserialize($unserialized) : \unserialize($unserialized);
$file->close();
} finally {
$unlock();