#25526 [Opn->Bgs]: call_user_func_array corrupts the passed array

From: Date: Mon, 15 Sep 2003 00:14:09 +0000
Subject: #25526 [Opn->Bgs]: call_user_func_array corrupts the passed array
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-47571@lists.php.net to get a copy of this message
ID: 25526 Updated by: iliaa@php.net Reported By: sprice at wisc dot edu -Status: Open +Status: Bogus Bug Type: Unknown/Other Function Operating System: OS X 10.2.6 PHP Version: 4.3.3 New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Re-read the documentation for call_user_func_array() more closely. Your test() should take 2 parameters, the 1st is the variable name and 2nd is the actual array. Previous Comments: ------------------------------------------------------------------------ [2003-09-13 11:57:47] sprice at wisc dot edu Description: ------------ call_user_func_array seems to corrupt the array that is passed to the user function through it. If an array of two strings are passed, and you try to print $strings[0] you get the first letter of the first element. If you try to print $strings[1] you get the 2nd letter of the first element. Reproduce code: --------------- <?php function test($testing){ echo $testing[1]; } $array = array('im testing', 'hello?'); call_user_func_array('test', $array); echo "\n"; echo $array[1]; ?> Expected result: ---------------- hello? hello? Actual result: -------------- m hello? ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=25526&edit=1

« previous php.bugs (#47571) next »