-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Don't substitute self/parent for anonymous class #19537
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
base: master
Are you sure you want to change the base?
Conversation
@@ -7089,18 +7089,21 @@ static zend_type zend_compile_single_typename(zend_ast *ast) | |||
zend_assert_valid_class_name(class_name, "a type name"); | |||
} else { | |||
ZEND_ASSERT(fetch_type == ZEND_FETCH_CLASS_SELF || fetch_type == ZEND_FETCH_CLASS_PARENT); | |||
bool substitute_self_parent = zend_is_scope_known() | |||
&& CG(active_class_entry) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this always true? (at this point that is)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not yet. It was either this condition, or duplicating the check in the self and parent branch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To clarify, no scope is considered a known scope.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, actually given the assert that doesn't make sense. I think it would have to be repeated either way. I thought I tried removing it but got a NULL pointer. I'll try again before merging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for tackling this, this had slipped my mind again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RM approval 👍
Change makes sense to me. Thank you for improving the error message here for the fix
Fixes GH-18373