From 0bd342e24aef49fc82a21bd4eedd3e665d177e5b Mon Sep 17 00:00:00 2001 From: Richard Heine Date: Sun, 25 Feb 2024 22:17:43 +0100 Subject: [PATCH] bugfix php jit issue with ternary operator see https://github.com/symfony/symfony/issues/54053 for more context --- Internal/Hydrator.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Internal/Hydrator.php b/Internal/Hydrator.php index d792aa5..49d636f 100644 --- a/Internal/Hydrator.php +++ b/Internal/Hydrator.php @@ -271,10 +271,19 @@ public static function getPropertyScopes($class) $name = $property->name; if (\ReflectionProperty::IS_PRIVATE & $flags) { - $propertyScopes["\0$class\0$name"] = $propertyScopes[$name] = [$class, $name, $flags & \ReflectionProperty::IS_READONLY ? $class : null, $property]; + $readonlyScope = null; + if ($flags & \ReflectionProperty::IS_READONLY) { + $readonlyScope = $class; + } + $propertyScopes["\0$class\0$name"] = $propertyScopes[$name] = [$class, $name, $readonlyScope, $property]; + continue; } - $propertyScopes[$name] = [$class, $name, $flags & \ReflectionProperty::IS_READONLY ? $property->class : null, $property]; + $readonlyScope = null; + if ($flags & \ReflectionProperty::IS_READONLY) { + $readonlyScope = $property->class; + } + $propertyScopes[$name] = [$class, $name, $readonlyScope, $property]; if (\ReflectionProperty::IS_PROTECTED & $flags) { $propertyScopes["\0*\0$name"] = $propertyScopes[$name];