From 75290af3d6c347015ebf0425bd4df79a0bbe775b Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Mon, 23 Jan 2023 14:01:22 +0100 Subject: [PATCH] Improve file reference --- .../MadelineProto/MTProtoTools/ReferenceDatabase.php | 8 ++++---- src/danog/MadelineProto/Settings/AppInfo.php | 2 +- src/danog/MadelineProto/Snitch.php | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/danog/MadelineProto/MTProtoTools/ReferenceDatabase.php b/src/danog/MadelineProto/MTProtoTools/ReferenceDatabase.php index 5feeaadd7..e19e2de91 100644 --- a/src/danog/MadelineProto/MTProtoTools/ReferenceDatabase.php +++ b/src/danog/MadelineProto/MTProtoTools/ReferenceDatabase.php @@ -418,7 +418,7 @@ final class ReferenceDatabase implements TLCallback { if (isset($this->refreshed[$location])) { $this->API->logger->logger('Reference already refreshed!', Logger::VERBOSE); - return ($this->db[$location])['reference']; + return (string) $this->db[$location]['reference']; } $locationValue = $this->db[$location]; \ksort($locationValue['origins']); @@ -474,7 +474,7 @@ final class ReferenceDatabase implements TLCallback throw new Exception("Unknown origin type {$originType}"); } if (isset($this->refreshed[$location])) { - return ($this->db[$location])['reference']; + return (string) $this->db[$location]['reference']; } } throw new Exception('Did not refresh reference'); @@ -490,7 +490,7 @@ final class ReferenceDatabase implements TLCallback if (!isset($this->db[$locationString]['reference'])) { if (isset($location['file_reference'])) { $this->API->logger->logger("Using outdated file reference for location of type {$locationType} object {$location['_']}", Logger::ULTRA_VERBOSE); - return $location['file_reference']; + return (string) $location['file_reference']; } if (!$this->refresh) { $this->API->logger->logger("Using null file reference for location of type {$locationType} object {$location['_']}", Logger::ULTRA_VERBOSE); @@ -502,7 +502,7 @@ final class ReferenceDatabase implements TLCallback if ($this->refresh) { return $this->refreshReferenceInternal($locationString); } - return $this->db[$locationString]['reference']; + return (string) $this->db[$locationString]['reference']; } private static function serializeLocation(int $locationType, array $location): string { diff --git a/src/danog/MadelineProto/Settings/AppInfo.php b/src/danog/MadelineProto/Settings/AppInfo.php index 690669a9c..93ae2fd33 100644 --- a/src/danog/MadelineProto/Settings/AppInfo.php +++ b/src/danog/MadelineProto/Settings/AppInfo.php @@ -68,6 +68,7 @@ final class AppInfo extends SettingsAbstract } elseif (isset($_SERVER['LANG'])) { $this->setLangCode(\explode('_', $_SERVER['LANG'])[0]); } + $this->appVersion = MTProto::RELEASE.' ('.MTProto::V.', '.Magic::$version.')'; $this->init(); } public function __wakeup(): void @@ -81,7 +82,6 @@ final class AppInfo extends SettingsAbstract if (isset(Lang::$lang[$this->langCode])) { Lang::$current_lang =& Lang::$lang[$this->langCode]; } - $this->appVersion = MTProto::RELEASE.' ('.MTProto::V.', '.Magic::$version.')'; } public function mergeArray(array $settings): void diff --git a/src/danog/MadelineProto/Snitch.php b/src/danog/MadelineProto/Snitch.php index a62c326f4..8f144ddcc 100644 --- a/src/danog/MadelineProto/Snitch.php +++ b/src/danog/MadelineProto/Snitch.php @@ -55,7 +55,7 @@ final class Snitch if (\count($this->hadInstalled) > self::MAX_NO_PHAR_STARTS) { \array_shift($this->hadInstalled); if (!\array_sum($this->hadInstalled)) { // For three times, MadelineProto was started with no phar file - $this->die(); + //$this->die(); } } }