From: tstarling at wikimedia dot org
Operating system: Linux
PHP version: 5.3.1
PHP Bug Type: Scripting Engine problem
Bug description: Reference argument converted to value in __call
Description:
------------
This is a regression in the PHP 5.3.1 release. When you call a __call()
function with a reference parameter, it is silently converted to a value,
by the time it reaches the second argument to __call().
This breaks MediaWiki and has no obvious workaround.
Reproduce code:
---------------
function foo( &$x ) {}
class Proxy {
function __call( $name, $args ) {
debug_zval_dump( $args );
call_user_func_array( 'foo', $args );
}
}
$arg = 1;
$args = array( &$arg );
$proxy = new Proxy;
call_user_func_array( array( &$proxy, 'bar' ), $args );
Expected result:
----------------
PHP 5.3.0 produces:
array(1) refcount(4){
[0]=>
&long(1) refcount(5)
}
Actual result:
--------------
array(1) refcount(4){
[0]=>
long(1) refcount(3)
}
Warning: Parameter 1 to foo() expected to be a reference, value given in
/home/tstarling/src/php/stuff/test-reference-call.php on line 8
--
Edit bug report at http://bugs.php.net/?id=50394&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=50394&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=50394&r=trysnapshot53
Try a snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=50394&r=trysnapshot60
Fixed in SVN:
http://bugs.php.net/fix.php?id=50394&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=50394&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=50394&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=50394&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=50394&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=50394&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=50394&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=50394&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=50394&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=50394&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=50394&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50394&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=50394&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=50394&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=50394&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=50394&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=50394&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=50394&r=mysqlcfg