Edit report at http://bugs.php.net/bug.php?id=50394&edit=1
ID: 50394 Comment by: hugoniks at hotmail 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: wtff Previous Comments: ------------------------------------------------------------------------ [2010-09-20 05:14:07] tstarling at wikimedia dot org heis: yes, the behaviour changed in 5.3.0. I'm not saying it was a good idea, I'm just saying you should complain on some other bug report, preferably one that I'm not CC'ed on. The correct way to pass reference arguments to functions via call_user_func_array() hasn't changed, we've been doing it this way since PHP 4. It's just that the impact of doing it the wrong way has changed. Previously, the argument was silently converted to a value. Now, a warning is shown and the function isn't called. ------------------------------------------------------------------------ [2010-09-19 10:54:53] heis dot turtlemad at gmail dot com 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 ? ------------------------------------------------------------------------ [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. ------------------------------------------------------------------------ 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