ID: 50394 Updated by: s...@php.net Reported By: tstarling at wikimedia dot org -Status: Open +Status: Closed Bug Type: Feature/Change Request Operating System: Linux PHP Version: 5.3.1 New Comment:
This bug has been fixed in SVN. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. fixed, thanks Previous Comments: ------------------------------------------------------------------------ [2009-12-18 19:12:12] s...@php.net Automatic comment from SVN on behalf of stas Revision: http://svn.php.net/viewvc/?view=revision&revision=292295 Log: fix regression bug #50394: Reference argument converted to value in __call ------------------------------------------------------------------------ [2009-12-17 19:15:18] s...@php.net This bug is actually deeper than it appears. The problem seems to be that when __call is used, user function is "simulated" by internal function processing __call. And there is when it gets hairy, since the simulating function does not accept parameters by-ref, so they get separated. I'll think about how to fix this situation - there might be a way to carry the reference through... ------------------------------------------------------------------------ [2009-12-08 04:46:10] tstarling at wikimedia dot org For the record, I've isolated this further, and the annotation suggests it was introduced in r287466 by stas in the course of fixing another bug. ------------------------------------------------------------------------ [2009-12-07 18:48:45] j...@php.net Feel free. ------------------------------------------------------------------------ [2009-12-07 09:51:29] tstarling at wikimedia dot org I fail to see the relationship with bug #49946. That's just someone reporting behaviour as a bug which was clearly documented in the 5.3 release notes as a deliberate change. I'm not complaining about the warning, which I just added to demonstrate the problem. I'm not complaining about the new behaviour of zend_call_function() as of PHP 5.3.0, I'm complaining about the lost reference in __call in PHP 5.3.1. The fact that the reference is lost makes it impossible for __call to implement an "out" parameter. Your own code still demostrates the bug nicely, if you change the $arg in the foreach to &$arg and then make foo() attempt to modify its parameter: <?php function foo( &$x ) { $x = 2; } class Proxy { function __call( $name, $args ) { debug_zval_dump( $args ); $pass = array(); foreach ($args as &$arg) $pass[] =& $arg; call_user_func_array( 'foo', $pass ); } } $arg = 1; $args = array( &$arg ); $proxy = new Proxy; call_user_func_array( array( $proxy, 'bar' ), $args ); debug_zval_dump( $arg ); ?> The final debug_zval_dump() produces 2 in PHP 5.3.0 and 1 in PHP 5.3.1. Jani, I seem to remember that last time our paths crossed, the issue ended up on php-dev: http://marc.info/?l=php-internals&m=124226646727485&w=2 I'm happy to take this one there as well if necessary. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/50394 -- Edit this bug report at http://bugs.php.net/?id=50394&edit=1