summaryrefslogtreecommitdiff
path: root/Zend/tests/enum/no-pass-properties-by-ref.phpt
blob: 8f429dfa1451cc340e266e1577b76114acf8e4da (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
--TEST--
Enum properties cannot be passed by-ref
--FILE--
<?php

enum Foo: int {
    case Bar = 0;
}

function setBarValueByRef(&$bar, $value) {
    $bar = $value;
}

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

var_dump(Foo::Bar->value);

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