From 97486f32d153a67458fce4df4eee7f8dafd18469 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20H=C3=A4u=C3=9Fler?= Date: Tue, 14 Oct 2025 22:24:50 +0200 Subject: [PATCH 1/2] Prefer `offsetSet` over deprecated `attach` `SplObjectStorage::attach()` is deprecated since PHP v8.5; `SplObjectStorage::offsetSet()` should be used instead [1]. [1]: https://github.com/php/php-src/pull/19424 --- src/ReflectionClass.php | 4 ++-- src/SerializationHandler.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ReflectionClass.php b/src/ReflectionClass.php index a069f16..bd57035 100644 --- a/src/ReflectionClass.php +++ b/src/ReflectionClass.php @@ -115,7 +115,7 @@ public static function getRefId(mixed &$reference, ?\SplObjectStorage $keepAlive } // we save this so the ref ids cannot be reused while serializing/deserializing - $keepAlive?->attach($ref); + $keepAlive?->offsetSet($ref); return $ref->getId(); } @@ -148,4 +148,4 @@ public static function getRawProperties(object $object, array $properties, ?stri return $data; } -} \ No newline at end of file +} diff --git a/src/SerializationHandler.php b/src/SerializationHandler.php index 602fe1c..a36e9b4 100644 --- a/src/SerializationHandler.php +++ b/src/SerializationHandler.php @@ -158,7 +158,7 @@ private function handleObject(object $data): object $box->data[1] = $this->getObjectVars($data, $info); // Add to priority - $this->priority->attach($box); + $this->priority->offsetSet($box); return $box; } @@ -289,4 +289,4 @@ private function &getCachedInfo(AbstractInfo $info): array $this->info[$key] ??= $info->__serialize(); return $this->info[$key]; } -} \ No newline at end of file +} From 227e64bd32fa5d1083449397c416a54519a47190 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20H=C3=A4u=C3=9Fler?= Date: Tue, 14 Oct 2025 22:58:54 +0200 Subject: [PATCH 2/2] Replace another `SplObjectStorage::attach` call by `offsetSet` --- src/SerializationHandler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SerializationHandler.php b/src/SerializationHandler.php index a36e9b4..de43d9d 100644 --- a/src/SerializationHandler.php +++ b/src/SerializationHandler.php @@ -125,7 +125,7 @@ private function handleObject(object $data): object if ($data instanceof stdClass) { // handle stdClass $obj = $this->handleStdClass($data); - $this->priority->attach($obj); + $this->priority->offsetSet($obj); return $obj; }