Skip to content
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

Fix zend_compile_func_decl scope #10794

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Zend/tests/closure_033.phpt
Expand Up @@ -23,7 +23,7 @@ $o->func();
?>
===DONE===
--EXPECTF--
{closure}()
Test::{closure}()

Fatal error: Uncaught Error: Call to private method Test::func() from global scope in %s:%d
Stack trace:
Expand Down
2 changes: 1 addition & 1 deletion Zend/tests/nested_method_and_function.phpt
Expand Up @@ -35,5 +35,5 @@ string(3) "bar"
string(12) "Baz\Foo::bar"
string(7) "Baz\Foo"
string(13) "Baz\{closure}"
string(13) "Baz\{closure}"
string(22) "Baz\Foo::Baz\{closure}"
string(7) "Baz\Foo"
1 change: 1 addition & 0 deletions Zend/zend_compile.c
Expand Up @@ -7215,6 +7215,7 @@ static void zend_compile_func_decl(znode *result, zend_ast *ast, bool toplevel)

if (decl->kind == ZEND_AST_CLOSURE || decl->kind == ZEND_AST_ARROW_FUNC) {
op_array->fn_flags |= ZEND_ACC_CLOSURE;
op_array->scope = CG(active_class_entry);
}

if (is_method) {
Expand Down