xref: /PHP-8.2/Zend/tests/bug70223.phpt (revision 902d6439)
1--TEST--
2Bug #70223 (Incrementing value returned by magic getter)
3--FILE--
4<?php
5
6// Note that this actually writes to dynamic property A::$f.
7// Increment goes through __set(), not __get() by reference!
8#[AllowDynamicProperties]
9class A {
10
11    private $foo = 0;
12
13    public function &__get($foo){ return $this->foo; }
14
15}
16
17$a = new A;
18echo $a->f++;
19echo $a->f++;
20echo $a->f++;
21?>
22--EXPECT--
23012
24