From:
Operating system: Ubuntu Linux 10.04
PHP version: 5.3.2
Package: Scripting Engine problem
Bug Type: Bug
Bug description:Array key moves when using func_get_args()
Description:
------------
Arrays get scrambled when using func_get_args(). See code sample below.
Test script:
---------------
<?php
function foo(/* ... */) {
$arguments = func_get_args();
if(isset($arguments[0]['key'])) {
var_dump($arguments[0]);
var_dump($arguments[1]);
echo "You see that \$arguments[0] is a string, while \$arguments[1] is
an array.\n";
echo "So this code should never get executed.\n";
} else {
echo "Correct behaviour";
}
}
foo("some string", array("key" => "value"));
Expected result:
----------------
Script output:
Correct behaviour
Actual result:
--------------
Script output:
string(11) "some string"
array(1) {
["key"]=>
string(5) "value"
}
string(1) "s"
You see that $arguments[0] is a string, while $arguments[1] is an array.
So this code should never get execute.
--
Edit bug report at http://bugs.php.net/bug.php?id=52114&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=52114&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=52114&r=trysnapshot53
Try a snapshot (trunk):
http://bugs.php.net/fix.php?id=52114&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=52114&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=52114&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=52114&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=52114&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=52114&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=52114&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=52114&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=52114&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=52114&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=52114&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=52114&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52114&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=52114&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=52114&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=52114&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=52114&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=52114&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=52114&r=mysqlcfg