php-src/Zend/tests/bug70805_2.phpt
Nikita Popov 902d64390e Deprecate implicit dynamic properties
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
2021-11-26 14:10:11 +01:00

43 lines
540 B
PHP

--TEST--
Bug #70805 (Segmentation faults whilst running Drupal 8 test suite) (Memleak)
--INI--
zend.enable_gc = 1
--FILE--
<?php
class A {
public $b;
}
class B {
public $a;
}
class C {
public function __destruct() {
if (isset($GLOBALS["a"])) {
unset($GLOBALS["a"]);
}
}
}
$a = new A;
$a->b = new B;
$a->b->a = $a;
$i = 0;
while ($i++ < 9999) {
$t = [];
$t[] = &$t;
unset($t);
}
$t = [new C];
$t[] = &$t;
unset($t);
unset($a);
var_dump(gc_collect_cycles());
?>
--EXPECT--
int(2)