Bug #74810 [Opn->Csd]: Something odd about ordering of func_get_args() result in 7.2

From: Date: Sun, 25 Jun 2017 14:00:46 +0000
Subject: Bug #74810 [Opn->Csd]: Something odd about ordering of func_get_args() result in 7.2
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-209675@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=74810&edit=1 ID: 74810 Updated by: nikic@php.net Reported by: daverandom@php.net Summary: Something odd about ordering of func_get_args() result in 7.2 -Status: Open +Status: Closed Type: Bug Package: Scripting Engine problem Operating System: Any PHP Version: 7.2.0alpha2 Block user comment: N Private report: N New Comment: Automatic comment on behalf of nikita.ppv@gmail.com Revision: http://git.php.net/?p=php-src.git;a=commit;h=ed37ca7369c7891cdbe7795ce96ad46dad7c1d26 Log: Fixed bug #74810 Previous Comments: ------------------------------------------------------------------------ [2017-06-24 21:40:59] daverandom@php.net 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 this bug report at https://bugs.php.net/bug.php?id=74810&edit=1

« previous php.bugs (#209675) next »