mirror of
https://github.com/php/php-src.git
synced 2024-09-22 02:17:32 +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
28 lines
441 B
PHP
28 lines
441 B
PHP
--TEST--
|
|
Bug #60536 (Traits Segfault)
|
|
--FILE--
|
|
<?php
|
|
trait T { private $x = 0; }
|
|
class X {
|
|
use T;
|
|
}
|
|
class Y extends X {
|
|
use T;
|
|
function __construct() {
|
|
return ++$this->x;
|
|
}
|
|
}
|
|
#[AllowDynamicProperties]
|
|
class Z extends Y {
|
|
function __construct() {
|
|
return ++$this->x;
|
|
}
|
|
}
|
|
$a = new Z();
|
|
$a->__construct();
|
|
echo "DONE";
|
|
?>
|
|
--EXPECTF--
|
|
Warning: Undefined property: Z::$x in %s on line %d
|
|
DONE
|