1--TEST--
2ZE2 ArrayAccess cannot assign by reference
3--FILE--
4<?php
5
6class ArrayAccessImpl implements ArrayAccess {
7	private $data = array();
8
9	public function offsetUnset($index) {}
10
11	public function offsetSet($index, $value) {
12		$this->data[$index] = $value;
13	}
14
15	public function offsetGet($index) {
16		return $this->data[$index];
17	}
18
19	public function offsetExists($index) {
20		return isset($this->data[$index]);
21	}
22}
23
24$data = new ArrayAccessImpl();
25$test = 'some data';
26$data['element'] = NULL; // prevent notice
27$data['element'] = &$test;
28
29?>
30===DONE===
31<?php exit(0); ?>
32--EXPECTF--
33Notice: Indirect modification of overloaded element of ArrayAccessImpl has no effect in %sarray_access_012.php on line 24
34
35Fatal error: Uncaught Error: Cannot assign by reference to overloaded object in %sarray_access_012.php:24
36Stack trace:
37#0 {main}
38  thrown in %sarray_access_012.php on line 24
39