xref: /PHP-8.1/Zend/tests/bug34893.phpt (revision f8d79582)
1--TEST--
2Bug #34893 (PHP5.1 overloading, Cannot access private property)
3--FILE--
4<?php
5class A {
6    private $p;
7    function __get($name){
8        return $this->$name;
9    }
10    function __set($name, $value) {
11        $this->$name = $value;
12    }
13}
14class B {
15    private $t;
16    function __get($name){
17        return $this->$name;
18    }
19    function __set($name, $value) {
20        $this->$name = $value;
21    }
22}
23$a = new A;
24$b = new B;
25$a->p = $b;
26$b->t = "foo";
27
28echo $a->p->t;
29$a->p->t = "bar";
30echo $a->p->t;
31?>
32--EXPECT--
33foobar
34