Skip to content

zend_compile: Set op_array->scope for Closures as compile time #18552

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

TimWolla
Copy link
Member

see #18546

@TimWolla
Copy link
Member Author

Okay, based on the discussion in #10782 this fix might break some optimization assumptions. I'll let the tests run just to see what they do, but I'm happy to just close and let someone more experienced with the engine do a proper fix.

@@ -8462,6 +8462,15 @@ static zend_op_array *zend_compile_func_decl_ex(
/* Pop the loop variable stack separator */
zend_stack_del_top(&CG(loop_var_stack));

if (op_array->fn_flags & ZEND_ACC_CLOSURE) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #10782 (comment) there is also a condition to skip this for traits, not sure, but highly likely there is a missing test for it with observer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants