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

26 lines
301 B
PHP

--TEST--
assign to object leaks with ref
--FILE--
<?php
function &a($i) {
$a = "str". $i ."ing";
return $a;
}
class A {
public $a;
public function test() {
$this->a = a(1);
unset($this->a);
}
}
$a = new A;
$a->test();
$a->test();
echo "okey";
?>
--EXPECT--
okey