Bug #52277 [NEW]: fatal error with call_user_func and function with by-reference arguments
| From: | abautu at gmail dot com | Date: | Wed, 07 Jul 2010 16:06:15 +0000 |
| Subject: | Bug #52277 [NEW]: fatal error with call_user_func and function with by-reference arguments | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-152184@lists.php.net to get a copy of this message | ||
From:
Operating system: Ubuntu 10.04
PHP version: 5.3.2
Package: Scripting Engine problem
Bug Type: Bug
Bug description:fatal error with call_user_func and function with by-reference arguments
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 bug report at http://bugs.php.net/bug.php?id=52277&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=52277&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=52277&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=52277&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=52277&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=52277&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=52277&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=52277&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=52277&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=52277&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=52277&r=support
Expected behavior: http://bugs.php.net/fix.php?id=52277&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=52277&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=52277&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=52277&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52277&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=52277&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=52277&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=52277&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=52277&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=52277&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=52277&r=mysqlcfg