Skip to content

Commit 76e0734

Browse files
committed
Zend: unify cleanup in zend_is_callable_at_frame()
1 parent af7a6c7 commit 76e0734

1 file changed

Lines changed: 14 additions & 17 deletions

File tree

Zend/zend_API.c

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4187,10 +4187,7 @@ ZEND_API bool zend_is_callable_at_frame(
41874187
}
41884188

41894189
ret = zend_is_string_callable(Z_STR_P(callable), frame, fcc, strict_class, error, check_flags & IS_CALLABLE_SUPPRESS_DEPRECATIONS);
4190-
if (fcc == &fcc_local) {
4191-
zend_release_fcall_info_cache(fcc);
4192-
}
4193-
return ret;
4190+
break;
41944191

41954192
case IS_ARRAY:
41964193
{
@@ -4238,30 +4235,30 @@ ZEND_API bool zend_is_callable_at_frame(
42384235
}
42394236

42404237
ret = zend_is_string_callable(Z_STR_P(method), frame, fcc, strict_class, error, check_flags & IS_CALLABLE_SUPPRESS_DEPRECATIONS);
4241-
if (fcc == &fcc_local) {
4242-
zend_release_fcall_info_cache(fcc);
4243-
}
4244-
return ret;
4238+
break;
42454239
}
42464240

42474241
case IS_OBJECT:
4248-
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) {
4249-
fcc->called_scope = fcc->calling_scope;
4250-
fcc->closure = Z_OBJ_P(callable);
4251-
if (fcc == &fcc_local) {
4252-
zend_release_fcall_info_cache(fcc);
4253-
}
4254-
return 1;
4242+
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) {
4243+
if (error) *error = estrdup("no array or string given");
4244+
return 0;
42554245
}
4256-
if (error) *error = estrdup("no array or string given");
4257-
return 0;
4246+
fcc->called_scope = fcc->calling_scope;
4247+
fcc->closure = Z_OBJ_P(callable);
4248+
ret = true;
4249+
break;
42584250
case IS_REFERENCE:
42594251
callable = Z_REFVAL_P(callable);
42604252
goto again;
42614253
default:
42624254
if (error) *error = estrdup("no array or string given");
42634255
return 0;
42644256
}
4257+
4258+
if (fcc == &fcc_local) {
4259+
zend_release_fcall_info_cache(fcc);
4260+
}
4261+
return ret;
42654262
}
42664263
/* }}} */
42674264

0 commit comments

Comments
 (0)