-
Notifications
You must be signed in to change notification settings - Fork 7.9k
gen_stub: Add support for attributes on constants in stubs #18735
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
gen_stub: Add support for attributes on constants in stubs #18735
Conversation
Update to PHP-Parser 5.5.0 and add support for attributes on constants in stubs. For now, I have only migrated over E_STRICT, once the support is in place I'll do a larger migration of the existing deprecated constants.
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.
LGTM once CI passes.
In order to fix the use-after-frees, you may try to set the attributes
array to NULL
inside free_zend_constant()
after releasing it, otherwise freeing may be attempted again if the function is called again, since the value of the pointer remains non-NULL (but it refers to garbage).
E.g. function attributes are freed the same way:
Line 163 in 3f03f7e
Wasn't triggered before so I didn't realize, zend_array_dup() is wrong
> PHP Warning: Undefined variable $code in build/gen_stub.php on line 5322 Introduced in php#18735.
Update to PHP-Parser 5.5.0 and add support for attributes on constants in stubs. For now, I have only migrated over E_STRICT, once the support is in place I'll do a larger migration of the existing deprecated constants.