-
Notifications
You must be signed in to change notification settings - Fork 7.8k
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
ReflectionFunction::getClosureUsedVariables() returns empty array in presence of variadic arguments #10623
Comments
Looks like it's implemented by reading the oplines, and I see that it explicitly uses |
I think I fixed it locally by checking the ZEND_ACC_VARIADIC flag, and moving one opline forward to skip the RECV_VARIADIC. I'll check it to be sure, write a test and PR this up. |
…s empty array in presence of variadic arguments Fixes phpGH-10623 The code was missing the handling for the RECV_VARIADIC instruction.
Co-authored-by: Fabio Ivona <fabio.ivona@defstudio.it>
Great! Thanks @nielsdos ! |
Description
It seems that when using a
ReflectionFunction
methodgetClosureUsedVariables()
to retrieve itsuse
variables, when the closure has a variadic argument,getClosureUsedVariables()
returns an empty arrayit can be reproduced (both in PHP8.1 and PHP8.2) by running this simple snipped
Resulted in this output:
But I expected this output instead:
PHP Version
PHP 8.2.2 (also in PHP 8.1.15 as well)
Operating System
tested in Ubuntu 20.04, 21.04 and alpine
Example snippet
https://onlinephp.io/c/1fd54
The text was updated successfully, but these errors were encountered: