From 5483f739501121444efad15cb6dbbfd9a8c3aedb Mon Sep 17 00:00:00 2001 From: Achim Fritz Date: Fri, 12 Jun 2026 08:46:34 +0200 Subject: [PATCH] [BUGFIX] ReflectionProperty::setAccessible() is deprecated since 8.5 a PHP Runtime Deprecation Notice is triggered when calling ReflectionProperty::setAccessible() in PHP 8.5 the method has no effect since PHP 8.1 s. https://www.php.net/manual/en/reflectionproperty.setaccessible.php --- src/JsonSerializer/JsonSerializer.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/JsonSerializer/JsonSerializer.php b/src/JsonSerializer/JsonSerializer.php index 4b16ea2..f1af960 100644 --- a/src/JsonSerializer/JsonSerializer.php +++ b/src/JsonSerializer/JsonSerializer.php @@ -548,7 +548,9 @@ protected function unserializeObject($value) foreach ($value as $property => $propertyValue) { try { $propRef = $this->getReflectionProperty($ref, $property); - $propRef->setAccessible(true); + if (version_compare(PHP_VERSION, '8.1.0') < 0) { + $propRef->setAccessible(true); + } $propRef->setValue($obj, $this->unserializeData($propertyValue)); } catch (ReflectionException $e) { switch ($this->undefinedAttributeMode) {