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 30
|
--TEST--
Asymmetric visibility reference in forbidden scope
--FILE--
<?php
class C {
public private(set) int $prop = 1;
}
function test($c) {
$prop = &$c->prop;
$prop = 42;
}
try {
test(new C());
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
test(new C());
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
Cannot indirectly modify private(set) property C::$prop from global scope
Cannot indirectly modify private(set) property C::$prop from global scope
|