summaryrefslogtreecommitdiff
path: root/Zend/tests/enum/no-write-properties-through-references.phpt
blob: 81543af78d6d97c1c16e7e763528d28168895e20 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
--TEST--
Enum properties cannot be written to through references
--FILE--
<?php

enum Foo: int {
    case Bar = 0;
}

try {
    $bar = Foo::Bar;
    $value = &$bar->value;
    $value = 1;
} catch (Error $e) {
    echo $e->getMessage() . "\n";
}

var_dump(Foo::Bar->value);

?>
--EXPECT--
Cannot acquire reference to property Foo::$value
int(0)