Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Closed
camporter wants to merge 1 commit into
php:PHP-8.1from
camporter:bug81611_fix
Closed

Ensure zend_ast_fetch_class uses scope it is provided to fetch classes#7649
camporter wants to merge 1 commit into
php:PHP-8.1from
camporter:bug81611_fix

Conversation

@camporter
Copy link
Copy Markdown
Contributor

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

cc @nikic

Comment thread Zend/zend_execute_API.c
switch (fetch_sub_type) {
case ZEND_FETCH_CLASS_SELF:
scope = zend_get_executed_scope();
if (scope == NULL) {
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.

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
Copy Markdown
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