1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Files
archived-php-src/Zend/tests/gh18581.phpt
Ilija Tovilo 23ec35bf4a Coerce numeric string keys from iterators when argument unpacking
Fixes GH-18581
Closes GH-19151
2025-07-22 17:46:34 +02:00

33 lines
536 B
PHP

--TEST--
GH-18581: Coerce numeric string keys from iterators when argument unpacking
--FILE--
<?php
function g() {
yield '100' => 'first';
yield '101' => 'second';
yield '102' => 'third';
yield 'named' => 'fourth';
}
function test($x = null, $y = null, ...$z) {
var_dump($x, $y, $z);
var_dump($z[0]);
var_dump($z['named']);
}
test(...g());
?>
--EXPECT--
string(5) "first"
string(6) "second"
array(2) {
[0]=>
string(5) "third"
["named"]=>
string(6) "fourth"
}
string(5) "third"
string(6) "fourth"