1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Files
Ilija Tovilo 8df557ac42 [RFC] Asymmetric visibility v2 (GH-15063)
Co-authored-by: Larry Garfield <larry@garfieldtech.com>
2024-08-27 02:04:48 +02:00

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