Bug #69259 [Fbk->Csd]: One reference passing fail with call_user_func_array() causes other fails

From: Date: Thu, 19 Mar 2015 08:33:26 +0000
Subject: Bug #69259 [Fbk->Csd]: One reference passing fail with call_user_func_array() causes other fails
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-191464@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69259&edit=1 ID: 69259 User updated by: ryosuke_i_628 at yahoo dot co dot jp Reported by: ryosuke_i_628 at yahoo dot co dot jp Summary: One reference passing fail with call_user_func_array() causes other fails -Status: Feedback +Status: Closed Type: Bug Package: *General Issues PHP Version: Irrelevant Block user comment: N Private report: N New Comment: To be sure. <?php function inc(&$a, &$b) { ++$a; ++$b; echo 'Function called' . PHP_EOL; } $a = 1; $b = 1; $params = array($a, &$b); call_user_func_array('inc', $params); var_dump($params); ?> I verified this script doesn't print "Function called", thanks. Previous Comments: ------------------------------------------------------------------------ [2015-03-19 08:19:13] laruence@php.net from what I can tell, it is by design, if the parameters checking is fail, the destination function won't be called. thus this behavior is expected. thanks ------------------------------------------------------------------------ [2015-03-19 05:36:27] ryosuke_i_628 at yahoo dot co dot jp Description: ------------ One reference passing fail with call_user_func_array() causes other fails. HHVM is already fixed on this issue, however, PHP 7 still has this problem. http://3v4l.org/jd9Nd Test script: --------------- <?php function inc(&$a, &$b) { ++$a; ++$b; } $a = 1; $b = 1; $params = array($a, &$b); call_user_func_array('inc', $params); var_dump($params); Expected result: ---------------- Warning: Parameter 1 to inc() expected to be a reference, value given in ... on line ... array(2) { [0]=> int(1) [1]=> &int(2) } Actual result: -------------- Warning: Parameter 1 to inc() expected to be a reference, value given in ... on line ... array(2) { [0]=> int(1) [1]=> &int(1) } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=69259&edit=1

« previous php.bugs (#191464) next »