[php-src] PR #12372: GH-12371: "internal error" in ReflectionParameter::getDefaultValue on Variable-length argument list
| From: | nielsdos | Date: | Fri, 06 Oct 2023 15:55:23 +0000 |
| Subject: | [php-src] PR #12372: GH-12371: "internal error" in ReflectionParameter::getDefaultValue on Variable-length argument list | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-23796@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/12372
Author: nielsdos
When you query if these are optional, they return true, but when you query the default value you get
an exception. From the documentation of getDefaultValue() [1] we see that:
> If the parameter is not optional a ReflectionException will be thrown.
So that seems to imply it should work with variadics.
The root cause is that we're only checking ZEND_RECV_INIT, and returning NULL in
get_default_from_recv() when encountering ZEND_RECV_VARIADIC. Fix it by adding an is_variadic
boolean that we can check. We'll also have to change zend_get_default_from_internal_arg_info()
to fix the support for internal arguments.