summaryrefslogtreecommitdiff
path: root/Zend/zend_vm_def.h
diff options
context:
space:
mode:
authorLevi Morrison <levim@php.net>2014-05-12 21:53:08 -0600
committerStanislav Malyshev <stas@php.net>2014-06-08 18:59:44 -0700
commitf47976dd9ba5318eb1e358c816288ecd70975d95 (patch)
tree8f401a1d004968c531b62c1599d8f95fc748a126 /Zend/zend_vm_def.h
parent38343856e19185042c54b2cbcc9185aafc741611 (diff)
downloadphp-git-f47976dd9ba5318eb1e358c816288ecd70975d95.tar.gz
Fix bug 666222
This also adds some smaller, isolated tests related to bug 66622.
Diffstat (limited to 'Zend/zend_vm_def.h')
-rw-r--r--Zend/zend_vm_def.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index 03cc9c45a0..f76e52961a 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -5179,6 +5179,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();
@@ -5187,7 +5188,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, (zend_function *) 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();