[php-src] Issue #8527: func_get_args returns wrong(?) result when using named arguments
| From: | v-m-i | Date: | Tue, 10 May 2022 13:45:21 +0000 |
| Subject: | [php-src] Issue #8527: func_get_args returns wrong(?) result when using named arguments | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-241450@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/8527
Author: v-m-i
### Description
I am trying to get arguments that were passed using
func_get_args, but the following
code:
```php
<?php
function hello(?string $one = null, ?string $two = null)
{
var_dump(func_get_args());
}
hello(one: 'one');
hello(two: 'two');
```
Resulted in this output:
```
array(1) {
[0]=>
string(3) "one"
}
array(2) {
[0]=>
NULL
[1]=>
string(3) "two"
}
```
I expected this output instead:
```
array(1) {
[0]=>
string(3) "one"
}
array(1) {
[1]=>
string(3) "two"
}
```
### PHP Version
PHP 8.1.15
### Operating System
Ubuntu 20.04