Commit a5e34c6030a for php.net
commit a5e34c6030acc6f482a8d4a0d12544a94438117a
Author: Daniel Scherzer <daniel.e.scherzer@gmail.com>
Date: Sun Jul 19 10:18:03 2026 -0700
`ReflectionClass::setStaticPropertyValue()`: update missing property error
Align with other Reflection exceptions for missing class properties (and
methods, constants, etc.) by changing the message to
"Property %s::$%s does not exist".
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index 3e1e41893e7..ec060cbbf3e 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -4195,7 +4195,7 @@ ZEND_METHOD(ReflectionClass, setStaticPropertyValue)
if (!variable_ptr) {
zend_clear_exception();
zend_throw_exception_ex(reflection_exception_ptr, 0,
- "Class %s does not have a property named %s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
+ "Property %s::$%s does not exist", ZSTR_VAL(ce->name), ZSTR_VAL(name));
RETURN_THROWS();
}
diff --git a/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_001.phpt b/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_001.phpt
index 2c855a04367..512fb5d6d91 100644
--- a/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_001.phpt
@@ -73,5 +73,5 @@ class B extends A {
)
Set non-existent values from A with no default value:
-Class A does not have a property named protectedDoesNotExist
-Class A does not have a property named privateDoesNotExist
+Property A::$protectedDoesNotExist does not exist
+Property A::$privateDoesNotExist does not exist
diff --git a/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_002.phpt b/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_002.phpt
index 82de2ce0c2a..2822471a397 100644
--- a/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_002.phpt
+++ b/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_002.phpt
@@ -49,6 +49,6 @@ class C {
ReflectionClass::setStaticPropertyValue() expects exactly 2 arguments, 1 given
Deprecated: ReflectionClass::setStaticPropertyValue(): Passing null to parameter #1 ($name) of type string is deprecated in %s on line %d
-Class C does not have a property named
-Class C does not have a property named 1.5
+Property C::$ does not exist
+Property C::$1.5 does not exist
ReflectionClass::setStaticPropertyValue(): Argument #1 ($name) must be of type string, array given