Skip to content

Commit a5e34c6

Browse files
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".
1 parent acf7ba8 commit a5e34c6

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

ext/reflection/php_reflection.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4195,7 +4195,7 @@ ZEND_METHOD(ReflectionClass, setStaticPropertyValue)
41954195
if (!variable_ptr) {
41964196
zend_clear_exception();
41974197
zend_throw_exception_ex(reflection_exception_ptr, 0,
4198-
"Class %s does not have a property named %s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
4198+
"Property %s::$%s does not exist", ZSTR_VAL(ce->name), ZSTR_VAL(name));
41994199
RETURN_THROWS();
42004200
}
42014201

ext/reflection/tests/ReflectionClass_setStaticPropertyValue_001.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,5 +73,5 @@ Array
7373
)
7474

7575
Set non-existent values from A with no default value:
76-
Class A does not have a property named protectedDoesNotExist
77-
Class A does not have a property named privateDoesNotExist
76+
Property A::$protectedDoesNotExist does not exist
77+
Property A::$privateDoesNotExist does not exist

ext/reflection/tests/ReflectionClass_setStaticPropertyValue_002.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,6 @@ ReflectionClass::setStaticPropertyValue() expects exactly 2 arguments, 0 given
4949
ReflectionClass::setStaticPropertyValue() expects exactly 2 arguments, 1 given
5050

5151
Deprecated: ReflectionClass::setStaticPropertyValue(): Passing null to parameter #1 ($name) of type string is deprecated in %s on line %d
52-
Class C does not have a property named
53-
Class C does not have a property named 1.5
52+
Property C::$ does not exist
53+
Property C::$1.5 does not exist
5454
ReflectionClass::setStaticPropertyValue(): Argument #1 ($name) must be of type string, array given

0 commit comments

Comments
 (0)