php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44626 call_user_func_array pass arguments by reference
Submitted: 2008-04-03 09:47 UTC Modified: 2008-04-03 11:08 UTC
From: HACGIS at gmail dot com Assigned:
Status: Not a bug Package: Variables related
PHP Version: 5.3CVS-2008-04-03 (snap) OS: Windows XP SP2
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
26 + 50 = ?
Subscribe to this entry?

 
 [2008-04-03 09:47 UTC] HACGIS at gmail dot com
Description:
------------
When a user function has some arguments which pass by reference, and use call_user_func_array to call the function, I find a bug.

In PHP 5.2 the code doesn't have any warning, But in PHP 5.3 snap I get a warning.

Reproduce code:
---------------
function test(&$arg){
	echo $arg;
}
$arg = 'OK<br>';
$arg_array1 = array(&$arg);
$arg_array2 = array($arg);
call_user_func_array('test', $arg_array1); // OK
call_user_func_array('test', $arg_array2); // get Warning



Expected result:
----------------
OK
OK

Actual result:
--------------
OK

Warning: Parameter 1 to test() expected to be a reference, value given in D:\DevWeb.bak\UserDir\test\index.php on line 9

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-04-03 11:08 UTC] jani@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.


 [2010-11-19 10:58 UTC] chat dot noir at arcor dot de
Why is this a warning?

CONTINUING EXECUTION AFTER IGNORED CALLS IS EVIL

Sorry for the caps, but I really mean it. Please make this at least an exception or fatal error until it is finally fixed.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 07:01:27 2024 UTC