-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Fix ReflectionFunction::isDeprecated()
for materialized __call()
#17914
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
Fix ReflectionFunction::isDeprecated()
for materialized __call()
#17914
Conversation
call.handler = zend_closure_call_magic; | ||
call.function_name = mptr->common.function_name; | ||
call.scope = mptr->common.scope; | ||
call.doc_comment = NULL; | ||
call.attributes = mptr->common.attributes; |
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.
I don't quite understand, why I do not need to increase the refcount here: If I do, I get a leak.
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.
call
isn't a trampoline, and the function call
is freed in zend_closure_free_storage
. The attributes are ignored by zend_closure_free_storage
. So you're counting on that the attributes of the original function outlive the closure instance.
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.
Now I actually wonder why we refcount the attributes for trampolines in the first place. They always come from a real function, and real functions should outlive trampolines I think. Maybe I'm missing something...
EDIT: I'm running the test suite now with refcounting removed.
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.
That seems to work fine.
The deprecated attribute is only since 8.4, but if the patch is going to expose all of the attributes from |
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.
This should be fine according to the discussion in #17880
As for the target branch: this is likely safe for 8.3
I can do this, but that would require cherry-picking f37b165 and 2542357 (incl. the tests that don't directly apply to 8.3, resulting in messy merges). Therefore I'd rather not do this, because for |
@TimWolla I agree, let's keep this in 8.4. |
* PHP-8.4: Fix `ReflectionFunction::isDeprecated()` for materialized `__call()` (#17914)
Fixes #17913