diff --git a/src/danog/MadelineProto/Serialization.php b/src/danog/MadelineProto/Serialization.php index 098e56751..54c207a8d 100644 --- a/src/danog/MadelineProto/Serialization.php +++ b/src/danog/MadelineProto/Serialization.php @@ -100,23 +100,28 @@ class Serialization \danog\MadelineProto\Logger::log('Lock acquired, deserializing'); try { - $unserialized = file_get_contents($realpaths['file']); + $tounserialize = file_get_contents($realpaths['file']); } finally { flock($realpaths['lockfile'], LOCK_UN); fclose($realpaths['lockfile']); } - $tounserialize = str_replace('O:26:"danog\\MadelineProto\\Button":', 'O:35:"danog\\MadelineProto\\TL\\Types\\Button":', $unserialized); - foreach (['RSA', 'TL\\TLMethod', 'TL\\TLConstructor', 'MTProto', 'API', 'DataCenter', 'Connection', 'TL\\Types\\Button', 'TL\\Types\\Bytes', 'APIFactory'] as $class) { - class_exists('\\danog\\MadelineProto\\'.$class); - } - class_exists('\\Volatile'); \danog\MadelineProto\Logger::class_exists(); try { $unserialized = unserialize($tounserialize); } catch (\danog\MadelineProto\Bug74586Exception $e) { + $tounserialize = str_replace('O:26:"danog\\MadelineProto\\Button":', 'O:35:"danog\\MadelineProto\\TL\\Types\\Button":', $unserialized); + foreach (['RSA', 'TL\\TLMethod', 'TL\\TLConstructor', 'MTProto', 'API', 'DataCenter', 'Connection', 'TL\\Types\\Button', 'TL\\Types\\Bytes', 'APIFactory'] as $class) { + class_exists('\\danog\\MadelineProto\\'.$class); + } + class_exists('\\Volatile'); $unserialized = \danog\Serialization::unserialize($tounserialize); } catch (\danog\MadelineProto\Exception $e) { + $tounserialize = str_replace('O:26:"danog\\MadelineProto\\Button":', 'O:35:"danog\\MadelineProto\\TL\\Types\\Button":', $unserialized); + foreach (['RSA', 'TL\\TLMethod', 'TL\\TLConstructor', 'MTProto', 'API', 'DataCenter', 'Connection', 'TL\\Types\\Button', 'TL\\Types\\Bytes', 'APIFactory'] as $class) { + class_exists('\\danog\\MadelineProto\\'.$class); + } + class_exists('\\Volatile'); Logger::log((string) $e, Logger::ERROR); if (strpos($e->getMessage(), "Erroneous data format for unserializing 'phpseclib\\Math\\BigInteger'") === 0) { $tounserialize = str_replace('phpseclib\\Math\\BigInteger', 'phpseclib\\Math\\BigIntegor', $unserialized);