[php-src] master: `ReflectionMethod::getPrototype()`: add parentheses to error message

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

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

`ReflectionMethod::getPrototype()`: add parentheses to error message

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


Diff:

diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index a068f9f48ac6..bba42bdfcc1a 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -3728,7 +3728,7 @@ ZEND_METHOD(ReflectionMethod, getPrototype)
 
 	if (!mptr->common.prototype) {
 		zend_throw_exception_ex(reflection_exception_ptr, 0,
-			"Method %s::%s does not have a prototype", ZSTR_VAL(intern->ce->name), ZSTR_VAL(mptr->common.function_name));
+			"Method %s::%s() does not have a prototype", ZSTR_VAL(intern->ce->name), ZSTR_VAL(mptr->common.function_name));
 		RETURN_THROWS();
 	}
 
diff --git a/ext/reflection/tests/bug74949.phpt b/ext/reflection/tests/bug74949.phpt
index 20e0fc00e101..858e766c0144 100644
--- a/ext/reflection/tests/bug74949.phpt
+++ b/ext/reflection/tests/bug74949.phpt
@@ -21,4 +21,4 @@ try  {
 Method [ <internal> public method __invoke ] {
 }
 
-Method Closure::__invoke does not have a prototype
+Method Closure::__invoke() does not have a prototype