1--TEST-- 2Bug #64417 (BC break: ArrayAccess::&offsetGet() in a trait causes fatal error) 3--FILE-- 4<?php 5trait aa { 6 private $container = array(); 7 public function offsetSet($offset, $value): void { 8 if (is_null($offset)) { 9 $this->container[] = $value; 10 } else { 11 $this->container[$offset] = $value; 12 } 13 } 14 public function offsetExists($offset): bool { 15 return isset($this->container[$offset]); 16 } 17 public function offsetUnset($offset): void { 18 unset($this->container[$offset]); 19 } 20 public function &offsetGet($offset): mixed { 21 $result = null; 22 if (isset($this->container[$offset])) { 23 $result = &$this->container[$offset]; 24 } 25 return $result; 26 } 27} 28 29class obj implements ArrayAccess { 30 use aa; 31} 32 33$o = new obj; 34$o['x'] = 1; 35++$o['x']; 36echo $o['x'], "\n"; 37?> 38--EXPECT-- 392 40