[php-src] Issue #11557: Assign to `&...$args` param ignores reference
| From: | mvorisek | Date: | Thu, 29 Jun 2023 11:40:57 +0000 |
| Subject: | [php-src] Issue #11557: Assign to `&...$args` param ignores reference | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-244834@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/11557
Author: mvorisek
### Description
The following code:
```php
<?php
function test(int &...$args) {
print_r($args);
$args[0] = 100;
$args = [1,2,3];
}
$test = [7,8,9];
test(...$test);
print_r($test);
```
https://3v4l.org/39PiM
Resulted in this output:
```
Array
(
[0] => 7
[1] => 8
[2] => 9
)
Array
(
[0] => 100
[1] => 8
[2] => 9
)
```
But I expected this output instead:
```
Array
(
[0] => 7
[1] => 8
[2] => 9
)
Array
(
[0] => 1
[1] => 2
[2] => 3
)
```
### PHP Version
any
### Operating System
any