From:
Operating system: Seven
PHP version: 5.3.3
Package: Scripting Engine problem
Bug Type: Bug
Bug description:call_user_func warning is inappropriate
Description:
------------
call_user_func now issue a warning in PHP5.3 when giving a value instead of
a
reference.
However, this warning shows up in inappropriate cases.
Test script:
---------------
<?php
//Function to be called via call_user_func
function test(&$z)
{
echo "ok : " . $z . "\n";
}
// - 1 : With a local variable
//This should work, but...
$a = 1;
call_user_func('test',$a);//Warning: Parameter 1 to test() expected to be a
reference, value given
// - 2 : Giving a constant
//This should issue a warning but ...
call_user_func('test',2);//works fine. Output "ok : 2"
// - 3 : Base on a parameter
//This should work, but ...
function test3($p=3)
{
call_user_func('test',$p);//Warning: Parameter 1 to test() expected to be a
reference, value given
}
test3();
?>
Expected result:
----------------
ok : 1
<b>Warning</b>: Parameter 1 to test() expected to be a reference, value
given in
...
ok : 3
Actual result:
--------------
<b>Warning</b>: Parameter 1 to test() expected to be a reference, value
given in
...
ok : 2
<br />
<b>Warning</b>: Parameter 1 to test() expected to be a reference, value
given in
...
--
Edit bug report at http://bugs.php.net/bug.php?id=52937&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=52937&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=52937&r=trysnapshot53
Try a snapshot (trunk):
http://bugs.php.net/fix.php?id=52937&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=52937&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=52937&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=52937&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=52937&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=52937&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=52937&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=52937&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=52937&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=52937&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=52937&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=52937&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52937&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=52937&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=52937&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=52937&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=52937&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=52937&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=52937&r=mysqlcfg