Bug #74810 [NEW]: Something odd about ordering of func_get_args() result in 7.2
| From: | daverandom@php.net | Date: | Sat, 24 Jun 2017 21:41:01 +0000 |
| Subject: | Bug #74810 [NEW]: Something odd about ordering of func_get_args() result in 7.2 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-209665@lists.php.net to get a copy of this message | ||
From: daverandom
Operating system: Any
PHP version: 7.2.0alpha2
Package: Scripting Engine problem
Bug Type: Bug
Bug description:Something odd about ordering of func_get_args() result in 7.2
Description:
------------
When using func_get_args() in combination with array_slice() in 7.2, the
results are incorrect. Hard to succinctly describe, see code sample.
https://3v4l.org/oSFoM
Test script:
---------------
<?php
function test_func_get_args() {
var_dump(func_get_args()); // as expected
}
function test_array_slice($array) {
var_dump(array_slice($array, 1)); // as expected
}
function test_array_slice_with_func_get_args() {
var_dump(array_slice(func_get_args(), 1)); // ???
}
$input = [1, 2, 3];
echo "=-=-=-= TEST func_get_args() =-=-=-=\n";
test_func_get_args(...$input);
echo "\n=-=-=-= TEST array_slice() =-=-=-=\n";
test_array_slice($input);
echo "\n=-=-=-= TEST 3 =-=-=-=\n";
test_array_slice_with_func_get_args(...$input);
Expected result:
----------------
=-=-=-= TEST func_get_args() =-=-=-=
array(3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
}
=-=-=-= TEST array_slice() =-=-=-=
array(2) {
[0]=>
int(2)
[1]=>
int(3)
}
=-=-=-= TEST 3 =-=-=-=
array(2) {
[0]=>
int(2)
[1]=>
int(3)
}
Actual result:
--------------
=-=-=-= TEST func_get_args() =-=-=-=
array(3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
}
=-=-=-= TEST array_slice() =-=-=-=
array(2) {
[0]=>
int(2)
[1]=>
int(3)
}
=-=-=-= TEST 3 =-=-=-=
array(2) {
[0]=>
int(1)
[1]=>
int(2)
}
--
Edit bug report at https://bugs.php.net/bug.php?id=74810&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74810&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74810&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74810&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=74810&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=74810&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=74810&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=74810&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=74810&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=74810&r=support
Expected behavior: https://bugs.php.net/fix.php?id=74810&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=74810&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=74810&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=74810&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74810&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=74810&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=74810&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=74810&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=74810&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=74810&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=74810&r=mysqlcfg