1--TEST--
2ZE2 ArrayAccess::offsetGet ambiguties
3--INI--
4error_reporting=4095
5--FILE--
6<?php
7class object implements ArrayAccess {
8
9	public $a = array('1st', 1, 2=>'3rd', '4th'=>4);
10
11	function offsetExists($index) {
12		echo __METHOD__ . "($index)\n";
13		return array_key_exists($index, $this->a);
14	}
15	function offsetGet($index) {
16		echo __METHOD__ . "($index)\n";
17		switch($index) {
18		case 1:
19			$a = 'foo';
20			return $a . 'Bar';
21		case 2:
22			static $a=1;
23			return $a;
24		}
25		return $this->a[$index];
26	}
27	function offsetSet($index, $newval) {
28		echo __METHOD__ . "($index,$newval)\n";
29		if ($index==3) {
30			$this->cnt = $newval;
31		}
32		return $this->a[$index] = $newval;
33	}
34	function offsetUnset($index) {
35		echo __METHOD__ . "($index)\n";
36		unset($this->a[$index]);
37	}
38}
39
40$obj = new Object;
41
42var_dump($obj[1]);
43var_dump($obj[2]);
44$obj[2]++;
45var_dump($obj[2]);
46
47?>
48===DONE===
49--EXPECTF--
50object::offsetGet(1)
51string(6) "fooBar"
52object::offsetGet(2)
53int(1)
54object::offsetGet(2)
55
56Notice: Indirect modification of overloaded element of object has no effect in %sarray_access_003.php on line 39
57object::offsetGet(2)
58int(1)
59===DONE===
60