ID:          50792
 Updated by:  j...@php.net
 Reported By: david at grudl dot com
-Status:      Feedback
+Status:      Bogus
 Bug Type:    Class/Object related
 PHP Version: 5.3.1
 New Comment:

See bug #50394 and next time, search first.


Previous Comments:
------------------------------------------------------------------------

[2010-01-18 17:22:30] j...@php.net

Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/

Both 5.3.2-dev and 5.2.12-dev return 2 for me. I don't have older
versions around to test. :)

------------------------------------------------------------------------

[2010-01-18 14:49:46] david at grudl dot com

Description:
------------
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 http://php.net/manual/en/function.call-user-func-array.php - 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)
        {
                $args[0]++;
        }
}



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


Expected result:
----------------
2


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


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=50792&edit=1

Reply via email to