xref: /PHP-8.1/Zend/tests/bug71336.phpt (revision f8d79582)
1--TEST--
2Bug #71336 (Wrong is_ref on properties as exposed via get_object_vars())
3--FILE--
4<?php
5class A
6{
7    protected $bar = array('baz');
8
9    function bar()
10    {
11        array_pop($this->bar);
12        $vars = get_object_vars($this);
13        $this->bar[] = array('buz');
14        print_r($vars);
15    }
16
17    function foo() {
18        array_pop($this->bar);
19        $dummy = &$this->bar;
20        $vars = get_object_vars($this);
21        $this->bar[] = array('buz');
22        print_r($vars);
23    }
24}
25
26(new A())->bar();
27(new A())->foo();
28?>
29--EXPECT--
30Array
31(
32    [bar] => Array
33        (
34        )
35
36)
37Array
38(
39    [bar] => Array
40        (
41            [0] => Array
42                (
43                    [0] => buz
44                )
45
46        )
47
48)
49