|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2015-03-19 05:36 UTC] 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) } PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Nov 04 21:00:01 2025 UTC |
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.