|
|
|
@ -5161,6 +5161,7 @@ ZEND_VM_HANDLER(153, ZEND_DECLARE_LAMBDA_FUNCTION, CONST, UNUSED) |
|
|
|
{ |
|
|
|
USE_OPLINE |
|
|
|
zend_function *op_array; |
|
|
|
int closure_is_static, closure_is_being_defined_inside_static_context; |
|
|
|
|
|
|
|
SAVE_OPLINE(); |
|
|
|
|
|
|
|
@ -5169,7 +5170,13 @@ ZEND_VM_HANDLER(153, ZEND_DECLARE_LAMBDA_FUNCTION, CONST, UNUSED) |
|
|
|
zend_error_noreturn(E_ERROR, "Base lambda function for closure not found"); |
|
|
|
} |
|
|
|
|
|
|
|
zend_create_closure(&EX_T(opline->result.var).tmp_var, op_array, EG(scope), EG(This) TSRMLS_CC); |
|
|
|
closure_is_static = op_array->common.fn_flags & ZEND_ACC_STATIC; |
|
|
|
closure_is_being_defined_inside_static_context = EX(prev_execute_data) && EX(prev_execute_data)->function_state.function->common.fn_flags & ZEND_ACC_STATIC; |
|
|
|
if (closure_is_static || closure_is_being_defined_inside_static_context) { |
|
|
|
zend_create_closure(&EX_T(opline->result.var).tmp_var, (zend_function *) op_array, EG(called_scope), NULL TSRMLS_CC); |
|
|
|
} else { |
|
|
|
zend_create_closure(&EX_T(opline->result.var).tmp_var, (zend_function *) op_array, EG(scope), EG(This) TSRMLS_CC); |
|
|
|
} |
|
|
|
|
|
|
|
CHECK_EXCEPTION(); |
|
|
|
ZEND_VM_NEXT_OPCODE(); |
|
|
|
|