Skip to content

Commit 21aa5cf

Browse files
committed
standard wording
1 parent 852a03b commit 21aa5cf

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

ext/reflection/php_reflection.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4137,8 +4137,8 @@ ZEND_METHOD(ReflectionClass, getStaticPropertyValue)
41374137
}
41384138

41394139
if (prop) {
4140-
zend_throw_exception_ex(reflection_exception_ptr, 0,
4141-
"Property %s::$%s is not initialized and no default was provided", ZSTR_VAL(ce->name), ZSTR_VAL(name));
4140+
zend_throw_error(NULL,
4141+
"Typed property %s::$%s must not be accessed before initialization", ZSTR_VAL(ce->name), ZSTR_VAL(name));
41424142
} else {
41434143
zend_throw_exception_ex(reflection_exception_ptr, 0,
41444144
"Property %s::$%s does not exist", ZSTR_VAL(ce->name), ZSTR_VAL(name));

ext/reflection/tests/gh12856.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ $rc = new ReflectionClass(Bug::class);
1313
var_dump($rc->getStaticPropertyValue('untyped'));
1414
try {
1515
var_dump($rc->getStaticPropertyValue('typed1'));
16-
} catch (ReflectionException $e) {
16+
} catch (Error $e) {
1717
echo $e->getMessage(), "\n";
1818
}
1919
var_dump($rc->getStaticPropertyValue('typed1', 1));
@@ -22,6 +22,6 @@ var_dump($rc->getStaticPropertyValue('typed2'));
2222
?>
2323
--EXPECT--
2424
NULL
25-
Property Bug::$typed1 is not initialized and no default was provided
25+
Typed property Bug::$typed1 must not be accessed before initialization
2626
int(1)
2727
int(3)

0 commit comments

Comments
 (0)