Req #48019 [Opn]: ReflectionMethod's invoke() and call_user_func() do not return by reference

From: Date: Sun, 08 Jul 2018 19:47:24 +0000
Subject: Req #48019 [Opn]: ReflectionMethod's invoke() and call_user_func() do not return by reference
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-216233@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=48019&edit=1 ID: 48019 Updated by: cmb@php.net Reported by: pulni4kiya at abv dot bg Summary: ReflectionMethod's invoke() and call_user_func() do not return by reference Status: Open Type: Feature/Change Request Package: Reflection related Operating System: * PHP Version: 5.2.9 Block user comment: N Private report: N New Comment: Behavior confirmed: <https://3v4l.org/NJBRv>. However, note the notice! Anyhow, this is either a bug or a documentation problem. Previous Comments: ------------------------------------------------------------------------ [2009-04-19 22:50:10] pulni4kiya at abv dot bg 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 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=48019&edit=1

« previous php.bugs (#216233) next »