Bug #50394 [Com]: Reference argument converted to value in __call
Edit report at http://bugs.php.net/bug.php?id=50394&edit=1 ID: 50394 Comment by: heis dot turtlemad at gmail dot com Reported by: tstarling at wikimedia dot org Summary: Reference argument converted to value in __call Status: Closed Type: Bug Package: Scripting Engine problem Operating System: Linux PHP Version: 5.3.1 Assigned To: pajoye New Comment: > Mediawiki is wrong in their comments. Not quite true. > There is a regression which was fixed in 5.3.2, > so upgrade to 5.3.2 is the right way to do it. Upgrading to 5.3.2 doesn't solve the issue, running the following softwares: FreeBSD 8/Nginx/MediaWiki 1.15.4 Any call to a Mediawiki extension fails on the following error: Downgrading to 5.2 is actually the only way to get rid of this. Previous Comments: [2010-06-06 19:04:27] paj...@php.net Mediawiki is wrong in their comments. There is a regression which was fixed in 5.3.2, so upgrade to 5.3.2 is the right way to do it. No need of further comments tho', the issue is fixed. Thanks for your feedbacks. [2010-06-06 18:55:37] PandoraBox2007 at gmail dot com install-utils.inc set comments /* $test = new PhpRefCallBugTester; $test->execute(); if ( !$test->ok ) { echo "PHP 5.3.1 is not compatible with MediaWiki due to a bug involving\n" . "reference parameters to __call. Upgrade to PHP 5.3.2 or higher, or \n" . "downgrade to PHP 5.3.0 to fix this.\n" . "ABORTING (see http://bugs.php.net/bug.php?id=50394 for details)\n"; die( -1 ); } */ [2010-06-06 18:12:56] PandoraBox2007 at gmail dot com fuccking PHP 5.3.2-SVN not working this shit [2010-04-12 22:53:24] tog7yt at yahoo dot com hljlkkga pbugs me [2010-04-07 05:59:03] clark4220 at yahoo dot com PLEASE EXPLAIN THE TRUE NATURE OF THE DISAGREEMENT 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/bug.php?id=50394 -- Edit this bug report at http://bugs.php.net/bug.php?id=50394&edit=1
Bug #51174 [Com]: error "expected to be a reference" when $this referenced in an array property
Edit report at http://bugs.php.net/bug.php?id=51174&edit=1 ID: 51174 Comment by: heis dot turtlemad at gmail dot com Reported by: skrol29forum at gmail dot com Summary: error "expected to be a reference" when $this referenced in an array property Status: Open Type: Bug Package: Scripting Engine problem Operating System: Win7 PHP Version: 5.3 New Comment: Same failure running Php5.3.2 on FreeBSD8 david:~>php test.php arg_array[0] is the same instance than $this prop=1 arg_array[0] is the same instance than $this Warning: Parameter 1 to f_test() expected to be a reference, value given in /usr/home/david/test.php on line 15 Previous Comments: [2010-06-21 00:03:55] fel...@php.net I can reproduce it. array(1) { [0]=> &object(clsTest)#1 (2) { ["prop"]=> int(0) ["arg_array"]=> *RECURSION* } } prop=1 array(1) { [0]=> object(clsTest)#1 (2) { ["prop"]=> int(1) ["arg_array"]=> *RECURSION* } } PHP Warning: Parameter 1 to f_test() expected to be a reference, value given [2010-03-01 08:24:57] skrol29forum at gmail dot com I've inverted "Expected result" and "Actual result". [2010-03-01 00:08:16] skrol29forum at gmail dot com Description: When $this is stored by reference in a PHP array, itself stored in a property, then function call_user_func_array() is able to recognize the reference only if called in the same local context where $this is referenced. In other words, the reference seems to be lost for call_user_func_array(). The bug does not occur with PHP 5.2, It does occur with both PHP 5.3.0 and PHP 5.3.1. Not yet tested with PHP 5.3.2 Note that if we use a global variable instead of a property, then the bug does not occur. Reproduce code: --- prop++; echo "prop=".$obj->prop." \r\n"; } class clsTest { public $prop = 0; public $arg_array = false; function meth() { if ($this->arg_array===false) $this->arg_array = array(&$this); echo 'arg_array[0] '.(($this->arg_array[0]===$this) ? ' is the same instance' : ' is not the same instance').' than $this'." \r\n"; call_user_func_array('f_test', $this->arg_array); } } $oTest = new clsTest; $oTest->meth(); // OK $oTest->meth(); // ERR ?> Expected result: arg_array[0] is the same instance than $this prop=1 arg_array[0] is the same instance than $this Warning: Parameter 1 to f_test() expected to be a reference, value given in D:\www\bug.php on line 14 Actual result: -- arg_array[0] is the same instance than $this prop=1 arg_array[0] is the same instance than $this prop=2 -- Edit this bug report at http://bugs.php.net/bug.php?id=51174&edit=1
Bug #50394 [Com]: Reference argument converted to value in __call
Edit report at http://bugs.php.net/bug.php?id=50394&edit=1 ID: 50394 Comment by: heis dot turtlemad at gmail dot com Reported by:tstarling at wikimedia dot org Summary:Reference argument converted to value in __call Status: Closed Type: Bug Package:Scripting Engine problem Operating System: Linux PHP Version:5.3.1 Assigned To:pajoye Block user comment: N New Comment: Please note that the "user code" we are talking about was running as expected until php5.3 was released; and that downgrading to 5.2 solves the issue. that means, that the way to pass arrays as references in function args has changed since the 5.3 release ? Previous Comments: [2010-09-15 02:23:34] tstarling at wikimedia dot org Commenters please note: you're receiving an error "parameter expected to be a reference, value given", that does not mean that you are seeing this bug. In fact, if you're using PHP 5.3.2 or later, it is pretty much impossible for it to be this bug. Most cases of "parameter expected to be a reference, value given" are due to bugs in the user code, not due to any problem with PHP. The message indicates a mismatch between the reference/value status of arguments to call_user_func_array() and the function declaration, as in: function foo( &$x ) {} $x = ''; call_user_func_array( 'foo', array( $x ) ); The correct way to call the function foo() in this case is: call_user_func_array( 'foo', array( &$x ) ); That is to say, the reference must be explicit in the array on the calling side. [2010-09-15 01:16:45] jeremy at tuxmachine dot com See bug 51174. [2010-09-04 01:16:50] david at tuxteam dot com This seems to be an issue for Drupal modules as well. This is a significant problem for running Drupal on PHP 5.3. [2010-08-10 09:14:45] parktrip at gmail dot com I have the same problem with mediawiki 1.15.5 and PHP 5.3.2 (lastest version from Zend Server) So is this a MW problem or PHP ? -------------------- [2010-07-23 01:09:33] heis dot turtlemad at gmail dot com > Mediawiki is wrong in their comments. Not quite true. > There is a regression which was fixed in 5.3.2, > so upgrade to 5.3.2 is the right way to do it. Upgrading to 5.3.2 doesn't solve the issue, running the following softwares: FreeBSD 8/Nginx/MediaWiki 1.15.4 Any call to a Mediawiki extension fails on the following error: Downgrading to 5.2 is actually the only way to get rid of this. 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/bug.php?id=50394 -- Edit this bug report at http://bugs.php.net/bug.php?id=50394&edit=1