|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50792 call_user_func_array, __call and references
Submitted: 2010-01-18 14:49 UTC Modified: 2010-01-18 17:23 UTC
From: david at grudl dot com Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 5.3.1 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: david at grudl dot com
New email:
PHP Version: OS:


 [2010-01-18 14:49 UTC] david at grudl dot com
The way how call_user_func_array() passes arguments to the function by reference has been broken in PHP versions 5.3.1, 5.2.11, 5.2.12 in conjunction with __call().

See - Note: Referenced variables in param_arr are passed to the function by a reference, others are passed by a value. In other words, it does not depend on the function signature whether the parameter is passed by a value or by a reference.

Reproduce code:
class Test
	public function __call($name, $args)

$viaRef = 1;
	array(new Test, 'method'), 
	array(& $viaRef)
echo $viaRef;

Expected result:

Actual result:
PHP 5.3.1, 5.2.11, 5.2.12 returns „1“, other versions „2“ as documented.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-01-18 17:23 UTC]
See bug #50394 and next time, search first.
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Mon Sep 28 13:01:23 2020 UTC