Skip to content

Commit 39fa31b

Browse files
authored
Remove redundant check in DECLARE_LAMBDA_FUNCTION handler (GH-25158)
When `Z_TYPE(EX(This)) == IS_OBJECT`, EX(func) is always non-static. Remove EXPECTED() for static closure, declaring static closures from non-static functions is not rare.
1 parent 467970b commit 39fa31b

2 files changed

Lines changed: 6 additions & 9 deletions

File tree

‎Zend/zend_vm_def.h‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8442,9 +8442,8 @@ ZEND_VM_HANDLER(142, ZEND_DECLARE_LAMBDA_FUNCTION, UNUSED, NUM, NUM|CACHE_SLOT)
84428442
}
84438443

84448444
func = (zend_function *) EX(func)->op_array.dynamic_func_defs[opline->op2.num];
8445-
if (Z_TYPE(EX(This)) == IS_OBJECT
8446-
&& EXPECTED(!(func->common.fn_flags & ZEND_ACC_STATIC))
8447-
&& EXPECTED(!(EX(func)->common.fn_flags & ZEND_ACC_STATIC))) {
8445+
if (Z_TYPE(EX(This)) == IS_OBJECT && !(func->common.fn_flags & ZEND_ACC_STATIC)) {
8446+
ZEND_ASSERT(!(EX(func)->common.fn_flags & ZEND_ACC_STATIC));
84488447
object = Z_OBJ(EX(This));
84498448
} else {
84508449
object = NULL;

‎Zend/zend_vm_execute.h‎

Lines changed: 4 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)