ID: 48019
User updated by: pulni4kiya at abv dot bg
-Summary: Problem with
Reported By: pulni4kiya at abv dot bg
Status: Open
Bug Type: Reflection related
PHP Version: 5.2.9
New Comment:
Missed something in the summmary
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 http://bugs.php.net/?id=48019&edit=1