|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-01-02 02:38 UTC] jani@php.net
-Package: Feature/Change Request
+Package: Reflection related
[2018-07-08 19:47 UTC] cmb@php.net
[2018-07-08 19:47 UTC] cmb@php.net
-Type: Feature/Change Request
+Type: Bug
[2023-04-12 11:39 UTC] talknewsbusiness at gmail dot com
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 20:00:01 2025 UTC |
Description: ------------ 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: ---------------- 100200300 Actual result: -------------- 100200200