mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00

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
21 lines
403 B
PHP
21 lines
403 B
PHP
--TEST--
|
|
Operators on overloaded property reference
|
|
--FILE--
|
|
<?php
|
|
class C {
|
|
private $bar;
|
|
function __construct() { $this->bar = str_repeat("1", 2); }
|
|
function &__get($x) { return $this->bar; }
|
|
function __set($x, $v) { $this->bar = $v; }
|
|
}
|
|
$x = new C;
|
|
var_dump(++$x->foo);
|
|
$x = new C;
|
|
var_dump($x->foo++);
|
|
$x = new C;
|
|
var_dump($x->foo += 2);
|
|
?>
|
|
--EXPECT--
|
|
int(12)
|
|
string(2) "11"
|
|
int(13)
|