summaryrefslogtreecommitdiff
path: root/Zend/tests/assign_ref_to_overloaded_prop.phpt
blob: e961b8bdf23bc719a6007edab219c8e8cd1f57b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
--TEST--
Cannot assign by reference to overloaded object, even if __get() returns by-ref
--FILE--
<?php

class Test {
    private $x;
    public function &__get($name) {
        return $this->x;
    }
}

$test = new Test;
$y = 5;
$test->x =& $y;
var_dump($test->x);

?>
--EXPECTF--
Fatal error: Uncaught Error: Cannot assign by reference to overloaded object in %s:%d
Stack trace:
#0 {main}
  thrown in %s on line %d