[php-src] master: `ReflectionClass::setStaticPropertyValue()`: update missing property error

Daniel Scherzer <[email protected]> Mon, 27 Jul 2026 17:37:55 +0000
Newsgroups gmane.comp.php.cvs.general
Message-ID <[email protected]>
Author: Daniel Scherzer (DanielEScherzer)
Date: 2026-07-27T10:36:50-07:00

Commit: https://github.com/php/php-src/commit/a5e34c6030acc6f482a8d4a0d12544a94438117a
Raw diff: https://github.com/php/php-src/commit/a5e34c6030acc6f482a8d4a0d12544a94438117a.diff

`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".

Changed paths:
  M  ext/reflection/php_reflection.c
  M  ext/reflection/tests/ReflectionClass_setStaticPropertyValue_001.phpt
  M  ext/reflection/tests/ReflectionClass_setStaticPropertyValue_002.phpt


Diff:

diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index 3e1e41893e72..ec060cbbf3e9 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 2c855a043674..512fb5d6d916 100644
--- a/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_001.phpt
+++ b/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_001.phpt
@@ -73,5 +73,5 @@ Array
 )
 
 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 82de2ce0c2a8..2822471a3971 100644
--- a/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_002.phpt
+++ b/ext/reflection/tests/ReflectionClass_setStaticPropertyValue_002.phpt
@@ -49,6 +49,6 @@ ReflectionClass::setStaticPropertyValue() expects exactly 2 arguments, 0 given
 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