1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Files
archived-php-src/Zend/tests/property_hooks/bug001.phpt
Ilija Tovilo 5b8a5320df Tweak get/set-only hook error messages
Fixes GH-19845
Closes GH-19916
2025-09-23 23:51:24 +02:00

31 lines
404 B
PHP

--TEST--
Bug 001
--FILE--
<?php
abstract class A {
abstract public $x { get; }
}
class C extends A {
private $_x;
public $x {
get => $this->_x;
}
}
var_dump((new ReflectionProperty(C::class, 'x'))->isVirtual());
$c = new C;
try {
$c->x = 3;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
bool(true)
Cannot write to get-only virtual property C::$x