mirror of
https://github.com/php/php-src.git
synced 2024-09-21 09:57:23 +00:00
902d64390e
Writing to a proprety that hasn't been declared is deprecated, unless the class uses the #[AllowDynamicProperties] attribute or defines __get()/__set(). RFC: https://wiki.php.net/rfc/deprecate_dynamic_properties
30 lines
429 B
PHP
30 lines
429 B
PHP
--TEST--
|
|
Object properties HT may need to be removed from nested data
|
|
--FILE--
|
|
<?php
|
|
|
|
#[AllowDynamicProperties]
|
|
class Test {
|
|
public function __destruct() {
|
|
$GLOBALS['x'] = $this;
|
|
}
|
|
}
|
|
|
|
$t = new Test;
|
|
$t->x = new stdClass;
|
|
$t->x->t = $t;
|
|
$a = (array) $t->x;
|
|
unset($t, $a);
|
|
gc_collect_cycles();
|
|
var_dump($x);
|
|
|
|
?>
|
|
--EXPECT--
|
|
object(Test)#1 (1) {
|
|
["x"]=>
|
|
object(stdClass)#2 (1) {
|
|
["t"]=>
|
|
*RECURSION*
|
|
}
|
|
}
|