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..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; } @@ -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 +}