diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 114b2c273ff..dfa084caa58 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -2306,10 +2306,10 @@ ZEND_METHOD(ReflectionParameter, __construct) /* nothing to do. don't set is_closure since is the invoke handler, not the closure itself */ } else if ((fptr = zend_hash_find_ptr(&ce->function_table, lcname)) == NULL) { + zend_throw_exception_ex(reflection_exception_ptr, 0, + "Method %s::%s() does not exist", ZSTR_VAL(ce->name), ZSTR_VAL(name)); zend_string_release(name); zend_string_release(lcname); - zend_throw_exception_ex(reflection_exception_ptr, 0, - "Method %s::%s() does not exist", ZSTR_VAL(ce->name), Z_STRVAL_P(method)); RETURN_THROWS(); } zend_string_release(name); diff --git a/ext/reflection/tests/ReflectionParameter_ctor_cast.phpt b/ext/reflection/tests/ReflectionParameter_ctor_cast.phpt new file mode 100644 index 00000000000..10f45647e6c --- /dev/null +++ b/ext/reflection/tests/ReflectionParameter_ctor_cast.phpt @@ -0,0 +1,18 @@ +--TEST-- +Test method name string cast in ReflectionParameter ctor +--FILE-- +getMessage(), "\n"; +} + +?> +--EXPECT-- +Method A::method() does not exist