php-src/Zend/tests/bug34893.phpt

34 lines
535 B
Plaintext
Raw Normal View History

--TEST--
Bug #34893 (PHP5.1 overloading, Cannot access private property)
--FILE--
<?php
class A {
2020-02-03 21:52:20 +00:00
private $p;
function __get($name){
return $this->$name;
}
function __set($name, $value) {
$this->$name = $value;
}
}
class B {
2020-02-03 21:52:20 +00:00
private $t;
function __get($name){
return $this->$name;
}
function __set($name, $value) {
$this->$name = $value;
}
}
$a = new A;
$b = new B;
$a->p = $b;
$b->t = "foo";
echo $a->p->t;
$a->p->t = "bar";
echo $a->p->t;
?>
--EXPECT--
foobar