php-src/Zend/tests/bug55305.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

18 lines
297 B
PHP

--TEST--
Bug #55305 (ref lost: 1st ref instantiated in class def, 2nd ref made w/o instantiating)
--FILE--
<?php
#[AllowDynamicProperties]
class Foo {
var $foo = "test";
}
$f = new Foo();
$f->bar =& $f->foo;
var_dump($f->foo);
var_dump($f->bar);
?>
--EXPECT--
string(4) "test"
string(4) "test"