mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
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:
commit
4bc5aa3531
4 changed files with 44 additions and 0 deletions
2
NEWS
2
NEWS
|
@ -9,6 +9,8 @@ PHP NEWS
|
|||
property). (ilutov)
|
||||
. Fixed bug GH-19044 (Protected properties are not scoped according to their
|
||||
prototype). (Bob)
|
||||
. Fixed bug GH-18581 (Coerce numeric string keys from iterators when argument
|
||||
unpacking). (ilutov)
|
||||
|
||||
- Hash:
|
||||
. Fix crash on clone failure. (nielsdos)
|
||||
|
|
32
Zend/tests/gh18581.phpt
Normal file
32
Zend/tests/gh18581.phpt
Normal 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"
|
|
@ -5329,6 +5329,11 @@ ZEND_VM_C_LABEL(send_again):
|
|||
}
|
||||
|
||||
name = Z_STR_P(&key);
|
||||
|
||||
zend_ulong tmp;
|
||||
if (ZEND_HANDLE_NUMERIC(name, tmp)) {
|
||||
name = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
5
Zend/zend_vm_execute.h
generated
5
Zend/zend_vm_execute.h
generated
|
@ -2419,6 +2419,11 @@ send_again:
|
|||
}
|
||||
|
||||
name = Z_STR_P(&key);
|
||||
|
||||
zend_ulong tmp;
|
||||
if (ZEND_HANDLE_NUMERIC(name, tmp)) {
|
||||
name = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue