1--TEST-- 2Bug #77275: OPcache optimization problem for ArrayAccess->offsetGet(string) 3--INI-- 4opcache.enable_cli=1 5opcache.optimization_level=-1 6--EXTENSIONS-- 7opcache 8--FILE-- 9<?php 10namespace Foo; 11class Bar { public function get() {} } 12class Record implements \ArrayAccess { 13 public function offsetSet($offset, $value): void { throw new \Exception; } 14 public function offsetGet($offset): mixed { var_dump($offset); return null; } 15 public function offsetExists($offset): bool { throw new \Exception; } 16 public function offsetUnset($offset): void { throw new \Exception; } 17} 18class Baz { 19 public function run() { 20 $a = pow(1, 2); 21 $b = new Bar(); 22 $c = new Bar(); 23 $d = new Bar(); 24 $id = $b->get('a', 'b', 'c'); 25 $rec = new Record(); 26 $id = $rec['a']; 27 } 28} 29(new Baz())->run(); 30?> 31--EXPECT-- 32string(1) "a" 33