[PHP-CVS] [php-src] master: Zend: unify cleanup in zend_is_callable_at_frame()

[email protected] (Gina Peter Banyard) Fri, 31 Jul 2026 12:56:53 +0000
Newsgroups php.cvs
Message-ID <[email protected]>
Author: Gina Peter Banyard (Girgias)
Date: 2026-07-31T13:56:30+01:00

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

Zend: unify cleanup in zend_is_callable_at_frame()

Changed paths:
  M  Zend/zend_API.c


Diff:

diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index 28f24774b71c..83c1ed312c78 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -4187,10 +4187,7 @@ ZEND_API bool zend_is_callable_at_frame(
 			}
 
 			ret = zend_is_string_callable(Z_STR_P(callable), frame, fcc, strict_class, error, check_flags & IS_CALLABLE_SUPPRESS_DEPRECATIONS);
-			if (fcc == &fcc_local) {
-				zend_release_fcall_info_cache(fcc);
-			}
-			return ret;
+			break;
 
 		case IS_ARRAY:
 			{
@@ -4238,23 +4235,18 @@ ZEND_API bool zend_is_callable_at_frame(
 				}
 
 				ret = zend_is_string_callable(Z_STR_P(method), frame, fcc, strict_class, error, check_flags & IS_CALLABLE_SUPPRESS_DEPRECATIONS);
-				if (fcc == &fcc_local) {
-					zend_release_fcall_info_cache(fcc);
-				}
-				return ret;
+				break;
 			}
 
 		case IS_OBJECT:
-			if (Z_OBJ_HANDLER_P(callable, get_closure) && Z_OBJ_HANDLER_P(callable, get_closure)(Z_OBJ_P(callable), &fcc->calling_scope, &fcc->function_handler, &fcc->object, 1) == SUCCESS) {
-				fcc->called_scope = fcc->calling_scope;
-				fcc->closure = Z_OBJ_P(callable);
-				if (fcc == &fcc_local) {
-					zend_release_fcall_info_cache(fcc);
-				}
-				return 1;
+			if (Z_OBJ_HANDLER_P(callable, get_closure) && Z_OBJ_HANDLER_P(callable, get_closure)(Z_OBJ_P(callable), &fcc->calling_scope, &fcc->function_handler, &fcc->object, 1) == FAILURE) {
+				if (error) *error = estrdup("no array or string given");
+				return 0;
 			}
-			if (error) *error = estrdup("no array or string given");
-			return 0;
+			fcc->called_scope = fcc->calling_scope;
+			fcc->closure = Z_OBJ_P(callable);
+			ret = true;
+			break;
 		case IS_REFERENCE:
 			callable = Z_REFVAL_P(callable);
 			goto again;
@@ -4262,6 +4254,11 @@ ZEND_API bool zend_is_callable_at_frame(
 			if (error) *error = estrdup("no array or string given");
 			return 0;
 	}
+
+	if (fcc == &fcc_local) {
+		zend_release_fcall_info_cache(fcc);
+	}
+	return ret;
 }
 /* }}} */