Edit report at http://bugs.php.net/bug.php?id=52277&edit=1
ID: 52277 Updated by: ras...@php.net Reported by: abautu at gmail dot com Summary: fatal error with call_user_func and function with by-reference arguments -Status: Open +Status: Bogus Type: Bug Package: Scripting Engine problem Operating System: Ubuntu 10.04 PHP Version: 5.3.2 New Comment: Passing a static string into a function that takes the parameter by reference makes no sense. If that function were to modify the passed parameter, there would be no place to store those changes, so this should fail. You also get a nice fat warning that looks like this: Warning: Parameter 1 to testfnc2() expected to be a reference, value given So make sure you have your error_reporting() level set high enough. Previous Comments: ------------------------------------------------------------------------ [2010-07-07 18:06:15] abautu at gmail dot com Description: ------------ I have a Drupal site. It worked ok until I upgraded php to 5.3.2. It simply fails, nothing is written to the error log or on the screen. I tracked down the problem to the following point: * in some file, there is this call: return call_user_func($hook_function, $variables, $suggestions); where $hook_function is _phptemplate_page * _phptemplate_page function is defined as: function _phptemplate_page(&$variables, &$suggestions) { .... } If I remove the & before variables, the site works. I know the by-reference variable behavior changed in 5.3.2 from 5.2, but in this case, the actual parameters are still 2 variables (not constants). Cheers, Andrei Test script: --------------- <?php function testfnc1($x) { echo "testfnc1: $x "; } function testfnc2(&$x) { echo "testfnc2: $x "; } $y = 'works'; call_user_func('testfnc1', $y); call_user_func('testfnc2', $y); Expected result: ---------------- testfnc1: works testfnc2: works Actual result: -------------- testfnc1: works ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=52277&edit=1