Skip to content

Fix JIT losing the called scope of self::/parent:: calls in included files - #25041

Closed
ndossche wants to merge 1 commit into
php:PHP-8.5from
ndossche:fix-jit-static-call-scope-include
Closed

ndossche wants to merge 1 commit into
php:PHP-8.5from
ndossche:fix-jit-static-call-scope-include

Conversation

@ndossche

Copy link
Copy Markdown
Member

File/eval code take This from the existing frame's scope, so This may be a class instead of an object.

Found while implementing fast-path for static property access in JIT

…files

File/eval code take This from the existing frame's scope,
so This may be a class instead of an object.

@iliaal iliaal left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. parent:: from an included file was broken the same way (tracing gave P:B P:A P:A for a P:B result) and this fixes it too, might be worth a second case in the test.

scope_ref = ir_LOAD_A(jit_EX(This.value.ref));
} else if (op_array->fn_flags & ZEND_ACC_CLOSURE) {
} else if ((op_array->fn_flags & ZEND_ACC_CLOSURE) || !op_array->function_name) {
/* Closured can be unbound, file/eval inherits This from the existing frame's scope. */

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Typo: Closured -> Closures.

@ndossche ndossche closed this in a7a49e0 Oct 30, 2026
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