|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48019 ReflectionMethod's invoke() and call_user_func() do not return by reference
Submitted: 2009-04-19 22:50 UTC Modified: 2018-07-08 19:47 UTC
Avg. Score:5.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:3 (100.0%)
Same OS:2 (66.7%)
From: pulni4kiya at abv dot bg Assigned:
Status: Open Package: Reflection related
PHP Version: 5.2.9 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: pulni4kiya at abv dot bg
New email:
PHP Version: OS:


 [2009-04-19 22:50 UTC] pulni4kiya at abv dot bg
The problem is that ReflectionMethod's invoke() method does not return reference (when it should)! Neither does call_user_func() for that matter.

Reproduce code:
class A {
	public static $c = 100;
	public static function &D() {
		return self::$c;

echo A::$c; //prints 100
$cRef1 =& A::D();
$cRef1 = 200;
echo A::$c; //prints 200
$a = new ReflectionClass('A');
$d = $a->getMethod('D');
$cRef2 =& $d->invoke(null); //DOES NOT RETURN REFERENCE!!!
$cRef2 = 300;
echo A::$c; //prints 200

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-02 02:38 UTC]
-Package: Feature/Change Request +Package: Reflection related
 [2018-07-08 19:47 UTC]
Behavior confirmed: <>.  However, note the

Anyhow, this is either a bug or a documentation problem.
 [2018-07-08 19:47 UTC]
-Type: Feature/Change Request +Type: Bug
 [2023-04-12 11:39 UTC] talknewsbusiness at gmail dot com
Business Talk News are sharing latest news about business, law, finance, tax, banking, loans, trading, share market etc. More info to visit: (
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 18:01:30 2024 UTC