xref: /PHP-8.3/Zend/tests/bugGH-8655.phpt (revision 96e3a9d3)
1--TEST--
2Bug GH-8655 (zval reference is not released when targetting a declared property)
3--FILE--
4<?php
5class Foo
6{
7    public $foo;
8}
9
10function hydrate($properties, $object)
11{
12    foreach ($properties as $name => &$value) {
13        $object->$name = &$value;
14    }
15};
16
17$object = new Foo;
18
19hydrate(['foo' => 123], $object);
20
21$arrayCast = (array) $object;
22
23$object->foo = 234;
24var_dump(ReflectionReference::fromArrayElement($arrayCast, 'foo'));
25echo $arrayCast['foo'];
26?>
27--EXPECT--
28NULL
29123
30