[php-src] Issue #8655: zval reference is not released when targetting a declared property

From: Date: Mon, 30 May 2022 10:06:32 +0000
Subject: [php-src] Issue #8655: zval reference is not released when targetting a declared property
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-241623@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/8655 Author: nicolas-grekas ### Description The following code produces the expected output on PHP < 8.1, but breaks on PHP >=8.1 see https://3v4l.org/L9WpO ```php class Foo { public $foo; } function hydrate($properties, $object) { foreach ($properties as $name => &$value) { $object->$name = &$value; } }; $object = new Foo; hydrate(['foo' => 123], $object); var_dump(ReflectionReference::fromArrayElement((array) $object, 'foo')); ``` Resulted in this output: ``` object(ReflectionReference)#2 (0) { } ``` But I expected this output instead: ``` NULL ``` ### PHP Version 8.1 ### Operating System _No response_

« previous php.bugs (#241623) next »