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

Ensure zend_ast_fetch_class uses scope it is provided to fetch classes #7649

Closed
wants to merge 1 commit into from

Conversation

camporter
Copy link
Contributor

Addresses bug 81611.
I'm a bit unsure on whether there's a better way to do this though...

cc @nikic

int fetch_sub_type = fetch_type & ZEND_FETCH_CLASS_MASK;

check_fetch_type:
switch (fetch_sub_type) {
case ZEND_FETCH_CLASS_SELF:
scope = zend_get_executed_scope();
if (scope == NULL) {
Copy link
Member

Choose a reason for hiding this comment

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

I think we could get into trouble here if the expression is supposed to be evaluated at global scope, in which case scope will be NULL and will fall back to the executed scope here. So we'd have to distinguish an explicit scope vs the fallback to the executed scope separately.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, forgot about global being NULL. Seems like the signature should allow providing the explicit vs execution scope? I'm out of my depth though so feel free to change/modify this.

@nikic nikic closed this in 812df2b Nov 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants