note 77613 deleted from function.call-user-func-array by danbrown

From: Date: Sat, 19 Jul 2008 20:55:37 +0000
Subject: note 77613 deleted from function.call-user-func-array by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-141732@lists.php.net to get a copy of this message
Note Submitter: Sc00bz ---- After looking at "php at paulbutler dot org" comment I tested the hack with a pass by value function just because I thought it might do something wrong, well it did. <?php function setargs($a1, $a2, $a3) // all are pass by value { $a1 = "one"; $a2 = "two"; $a3 = "three"; } $args = array("1","2","3"); $hack = array(); foreach ($args as &$v) $hack[] =& $v; call_user_func_array("setargs", $args); echo implode(" ", $args); ?> Displays "one two three", instead of the expected "1 2 3". Someone should really test this on the current version of php and report this bug.

« previous php.notes (#141732) next »