xref: /PHP-5.4/Zend/tests/objects_032.phpt (revision 105db96e)
1--TEST--
2Covariant return-by-ref constraints
3--FILE--
4<?php
5
6class A implements ArrayAccess {
7    public $foo = array();
8
9    public function &offsetGet($n) {
10        return $this->foo[$n];
11    }
12
13    public function offsetSet($n, $v) {
14    }
15    public function offsetUnset($n) {
16    }
17    public function offsetExists($n) {
18    }
19}
20
21$a = new A;
22
23$a['foo']['bar'] = 2;
24
25var_dump($a);
26
27?>
28==DONE==
29--EXPECTF--
30object(A)#1 (1) {
31  ["foo"]=>
32  array(1) {
33    ["foo"]=>
34    array(1) {
35      ["bar"]=>
36      int(2)
37    }
38  }
39}
40==DONE==
41