mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07: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
363 B
PHP
30 lines
363 B
PHP
--TEST--
|
|
Bug #27268 (Bad references accentuated by clone)
|
|
--FILE--
|
|
<?php
|
|
#[AllowDynamicProperties]
|
|
class A
|
|
{
|
|
public function &getA()
|
|
{
|
|
return $this->a;
|
|
}
|
|
}
|
|
|
|
$A = new A;
|
|
$A->a = array(1);
|
|
$x = $A->getA();
|
|
$clone = clone $A;
|
|
$clone->a = array();
|
|
print_r($A);
|
|
?>
|
|
--EXPECT--
|
|
A Object
|
|
(
|
|
[a] => Array
|
|
(
|
|
[0] => 1
|
|
)
|
|
|
|
)
|