blob: e288b9a694f1737cf06bf382b94ebf626b9efafa (
plain)
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
|
--TEST--
Enum offsetGet in constant expression
--FILE--
<?php
enum Foo implements ArrayAccess {
case Bar;
public function offsetGet($key) {
return 42;
}
public function offsetExists($key) {}
public function offsetSet($key, $value) {}
public function offsetUnset($key) {}
}
class X {
const FOO_BAR = Foo::Bar[0];
}
var_dump(X::FOO_BAR);
?>
--EXPECTF--
Fatal error: Uncaught Error: Cannot use [] on objects in constant expression in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d
|