1--TEST--
2Enum properties cannot be written to through reference in foreach
3--FILE--
4<?php
5
6enum Foo: int {
7    case Bar = 0;
8}
9
10try {
11    $bar = Foo::Bar;
12    foreach ([1] as &$bar->value) {}
13} catch (Error $e) {
14    echo $e->getMessage() . "\n";
15}
16
17var_dump(Foo::Bar->value);
18
19?>
20--EXPECT--
21Cannot modify readonly property Foo::$value
22int(0)
23