mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
31 lines
516 B
PHP
31 lines
516 B
PHP
--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
|