Skip to content

Commit 7af9ba2

Browse files
committed
Saving the latter checking in most cases
1 parent fff921d commit 7af9ba2

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

Zend/zend_vm_def.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5191,7 +5191,6 @@ ZEND_VM_HANDLER(153, ZEND_DECLARE_LAMBDA_FUNCTION, CONST, UNUSED)
51915191
{
51925192
USE_OPLINE
51935193
zend_function *op_array;
5194-
int closure_is_static, closure_is_being_defined_inside_static_context;
51955194

51965195
SAVE_OPLINE();
51975196

@@ -5200,9 +5199,9 @@ ZEND_VM_HANDLER(153, ZEND_DECLARE_LAMBDA_FUNCTION, CONST, UNUSED)
52005199
zend_error_noreturn(E_ERROR, "Base lambda function for closure not found");
52015200
}
52025201

5203-
closure_is_static = op_array->common.fn_flags & ZEND_ACC_STATIC;
5204-
closure_is_being_defined_inside_static_context = EX(prev_execute_data) && EX(prev_execute_data)->function_state.function->common.fn_flags & ZEND_ACC_STATIC;
5205-
if (closure_is_static || closure_is_being_defined_inside_static_context) {
5202+
if (UNEXPECTED((op_array->common.fn_flags & ZEND_ACC_STATIC) ||
5203+
(EX(prev_execute_data) &&
5204+
EX(prev_execute_data)->function_state.function->common.fn_flags & ZEND_ACC_STATIC))) {
52065205
zend_create_closure(&EX_T(opline->result.var).tmp_var, (zend_function *) op_array, EG(called_scope), NULL TSRMLS_CC);
52075206
} else {
52085207
zend_create_closure(&EX_T(opline->result.var).tmp_var, (zend_function *) op_array, EG(scope), EG(This) TSRMLS_CC);

Zend/zend_vm_execute.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6494,7 +6494,6 @@ static int ZEND_FASTCALL ZEND_DECLARE_LAMBDA_FUNCTION_SPEC_CONST_UNUSED_HANDLER
64946494
{
64956495
USE_OPLINE
64966496
zend_function *op_array;
6497-
int closure_is_static, closure_is_being_defined_inside_static_context;
64986497

64996498
SAVE_OPLINE();
65006499

@@ -6503,9 +6502,9 @@ static int ZEND_FASTCALL ZEND_DECLARE_LAMBDA_FUNCTION_SPEC_CONST_UNUSED_HANDLER
65036502
zend_error_noreturn(E_ERROR, "Base lambda function for closure not found");
65046503
}
65056504

6506-
closure_is_static = op_array->common.fn_flags & ZEND_ACC_STATIC;
6507-
closure_is_being_defined_inside_static_context = EX(prev_execute_data) && EX(prev_execute_data)->function_state.function->common.fn_flags & ZEND_ACC_STATIC;
6508-
if (closure_is_static || closure_is_being_defined_inside_static_context) {
6505+
if (UNEXPECTED((op_array->common.fn_flags & ZEND_ACC_STATIC) ||
6506+
(EX(prev_execute_data) &&
6507+
EX(prev_execute_data)->function_state.function->common.fn_flags & ZEND_ACC_STATIC))) {
65096508
zend_create_closure(&EX_T(opline->result.var).tmp_var, (zend_function *) op_array, EG(called_scope), NULL TSRMLS_CC);
65106509
} else {
65116510
zend_create_closure(&EX_T(opline->result.var).tmp_var, (zend_function *) op_array, EG(scope), EG(This) TSRMLS_CC);

0 commit comments

Comments
 (0)