mirror of
https://github.com/danog/MadelineProto.git
synced 2025-01-22 21:31:28 +01:00
Revert back some wrong changes ...
This commit is contained in:
parent
c7b222ed78
commit
008ccd9c79
@ -73,13 +73,13 @@ final class PostgresArray extends PostgresArrayBytea
|
|||||||
{
|
{
|
||||||
$this->serializer = match ($serializer) {
|
$this->serializer = match ($serializer) {
|
||||||
SerializerType::SERIALIZE => fn ($v) => \bin2hex(\serialize($v)),
|
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::JSON => fn ($v) => \bin2hex(\json_encode($v, JSON_THROW_ON_ERROR|JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES)),
|
||||||
SerializerType::STRING => fn ($v) => \bin2hex(\strval($v)),
|
SerializerType::STRING => fn ($v) => \bin2hex(\strval($v)),
|
||||||
};
|
};
|
||||||
$this->deserializer = match ($serializer) {
|
$this->deserializer = match ($serializer) {
|
||||||
SerializerType::SERIALIZE => fn ($v) => \unserialize(\hex2bin($v)),
|
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::JSON => fn ($value) => \json_decode(\hex2bin($value), true, 256, JSON_THROW_ON_ERROR),
|
||||||
SerializerType::STRING => fn ($v) => \hex2bin($v),
|
SerializerType::STRING => fn ($v) => \hex2bin($v),
|
||||||
};
|
};
|
||||||
|
@ -91,7 +91,7 @@ class PostgresArrayBytea extends SqlArray
|
|||||||
{
|
{
|
||||||
$this->serializer = match ($serializer) {
|
$this->serializer = match ($serializer) {
|
||||||
SerializerType::SERIALIZE => fn ($v) => new ByteA(\serialize($v)),
|
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::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)),
|
SerializerType::STRING => fn ($v) => new ByteA(\strval($v)),
|
||||||
};
|
};
|
||||||
|
@ -70,7 +70,7 @@ final class WebRunner extends RunnerAbstract
|
|||||||
'cwd' => Magic::getcwd(),
|
'cwd' => Magic::getcwd(),
|
||||||
'MadelineSelfRestart' => 1
|
'MadelineSelfRestart' => 1
|
||||||
];
|
];
|
||||||
if (\function_exists('memprof_enabled') && memprof_enabled()) {
|
if (\function_exists('memprof_enabled') && \memprof_enabled()) {
|
||||||
$params['MEMPROF_PROFILE'] = '1';
|
$params['MEMPROF_PROFILE'] = '1';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1757,13 +1757,13 @@ final class MTProto implements TLCallback, LoggerGetter
|
|||||||
if (!\extension_loaded('memprof')) {
|
if (!\extension_loaded('memprof')) {
|
||||||
throw Exception::extension('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.");
|
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";
|
$current = "Current memory usage: ".\round(\memory_get_usage()/1024/1024, 1) . " MB";
|
||||||
$file = \fopen('php://memory', 'r+');
|
$file = \fopen('php://memory', 'r+');
|
||||||
memprof_dump_pprof($file);
|
\memprof_dump_pprof($file);
|
||||||
\fseek($file, 0);
|
\fseek($file, 0);
|
||||||
$file = [
|
$file = [
|
||||||
'_' => 'inputMediaUploadedDocument',
|
'_' => 'inputMediaUploadedDocument',
|
||||||
|
@ -140,7 +140,7 @@ final class SessionPaths
|
|||||||
.\chr(PHP_MAJOR_VERSION)
|
.\chr(PHP_MAJOR_VERSION)
|
||||||
.\chr(PHP_MINOR_VERSION)
|
.\chr(PHP_MINOR_VERSION)
|
||||||
.\chr(Magic::$can_use_igbinary ? 1 : 0)
|
.\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(
|
write(
|
||||||
"$path.temp.php",
|
"$path.temp.php",
|
||||||
@ -198,7 +198,7 @@ final class SessionPaths
|
|||||||
$headerLen++;
|
$headerLen++;
|
||||||
}
|
}
|
||||||
$unserialized = $file->read(null, $size - $headerLen) ?? '';
|
$unserialized = $file->read(null, $size - $headerLen) ?? '';
|
||||||
$unserialized = $igbinary ? igbinary_unserialize($unserialized) : \unserialize($unserialized);
|
$unserialized = $igbinary ? \igbinary_unserialize($unserialized) : \unserialize($unserialized);
|
||||||
$file->close();
|
$file->close();
|
||||||
} finally {
|
} finally {
|
||||||
$unlock();
|
$unlock();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user