Merge branch 'PHP-8.3' into PHP-8.4

* PHP-8.3:
  Coerce numeric string keys from iterators when argument unpacking
This commit is contained in:
Ilija Tovilo 2025-07-22 17:47:56 +02:00
commit 4bc5aa3531
No known key found for this signature in database
GPG key ID: 5050C66BFCD1015A
4 changed files with 44 additions and 0 deletions

2
NEWS
View file

@ -9,6 +9,8 @@ PHP NEWS
property). (ilutov) property). (ilutov)
. Fixed bug GH-19044 (Protected properties are not scoped according to their . Fixed bug GH-19044 (Protected properties are not scoped according to their
prototype). (Bob) prototype). (Bob)
. Fixed bug GH-18581 (Coerce numeric string keys from iterators when argument
unpacking). (ilutov)
- Hash: - Hash:
. Fix crash on clone failure. (nielsdos) . Fix crash on clone failure. (nielsdos)

32
Zend/tests/gh18581.phpt Normal file
View file

@ -0,0 +1,32 @@
--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"

View file

@ -5329,6 +5329,11 @@ ZEND_VM_C_LABEL(send_again):
} }
name = Z_STR_P(&key); name = Z_STR_P(&key);
zend_ulong tmp;
if (ZEND_HANDLE_NUMERIC(name, tmp)) {
name = NULL;
}
} }
} }

View file

@ -2419,6 +2419,11 @@ send_again:
} }
name = Z_STR_P(&key); name = Z_STR_P(&key);
zend_ulong tmp;
if (ZEND_HANDLE_NUMERIC(name, tmp)) {
name = NULL;
}
} }
} }