summaryrefslogtreecommitdiff
path: root/Zend/tests/enum/no-return-properties-by-ref.phpt
blob: 988d480de1b63a3b9d92f10940550cf8edc78529 (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
--TEST--
Enum properties cannot be returned by-ref
--FILE--
<?php

enum Foo: int {
    case Bar = 0;
}

function &getBarValueByRef() {
    $bar = Foo::Bar;
    return $bar->value;
}

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

var_dump(Foo::Bar->value);

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