summaryrefslogtreecommitdiff
path: root/Zend/tests/bug37667.phpt
blob: 38adb4e9989b0e41a082d7f0114078bc965b5af2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
--TEST--
Bug #37667 (Object is not added into array returned by __get)
--FILE--
<?php

class Test
{
    protected $property = array('foo' => 'bar');

    function __get($name)
    {
        return $this->property;
    }
}

$obj = new Test;

var_dump($obj->property['foo']);
var_dump($obj->property[2]);

var_dump($obj);

$obj->property[] = 1;
$obj->property[] = 2;

var_dump($obj);

?>
--EXPECTF--
string(3) "bar"

Notice: Undefined offset: 2 in %sbug37667.php on line 16
NULL
object(Test)#%d (1) {
  ["property":protected]=>
  array(1) {
    ["foo"]=>
    string(3) "bar"
  }
}

Notice: Indirect modification of overloaded property Test::$property has no effect in %sbug37667.php on line 20

Notice: Indirect modification of overloaded property Test::$property has no effect in %sbug37667.php on line 21
object(Test)#%d (1) {
  ["property":protected]=>
  array(1) {
    ["foo"]=>
    string(3) "bar"
  }
}