forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbug77275.phpt
More file actions
32 lines (32 loc) · 869 Bytes
/
bug77275.phpt
File metadata and controls
32 lines (32 loc) · 869 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
--TEST--
Bug #77275: OPcache optimization problem for ArrayAccess->offsetGet(string)
--INI--
opcache.enable_cli=1
opcache.optimization_level=-1
--EXTENSIONS--
opcache
--FILE--
<?php
namespace Foo;
class Bar { public function get() {} }
class Record implements \ArrayAccess {
public function offsetSet($offset, $value): void { throw new \Exception; }
public function offsetGet($offset): mixed { var_dump($offset); return null; }
public function offsetExists($offset): bool { throw new \Exception; }
public function offsetUnset($offset): void { throw new \Exception; }
}
class Baz {
public function run() {
$a = pow(1, 2);
$b = new Bar();
$c = new Bar();
$d = new Bar();
$id = $b->get('a', 'b', 'c');
$rec = new Record();
$id = $rec['a'];
}
}
(new Baz())->run();
?>
--EXPECT--
string(1) "a"