|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-09-29 20:58 UTC] sniper@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 14 04:00:01 2025 UTC |
Description: ------------ Unfortunatly even in version 4.3.3 there was an bug with "call_user_func_array" function. call_user_func and call_user_func do respect functions that return references. That is, function foo that returns a references to an object, does not return a reference to an object when foo is called via call_user_func. Instead, foo called via call_user_func returns a "copy" of the object. (I'm not sure "copy" is the right word.) See the code example for a concise example of the problem. Reproduce code: --------------- function &testfunction() { global $testglobal; return ($testglobal=1); } $testglobal_link=&call_user_func_array("testfunction",array('testparam-1','testparam-2')); // $testglobal_link must be link to $testglobal at this stage print $testglobal_link; // trying to assign new value to $testglobal thru link $testglobal_link=2; // in theory we will get "2" as result print $testglobal; // but unfortunatly we will have "1" as result print $testglobal_link;