From: enygma at phpdeveloper dot org
Operating system: Red Hat Linux
PHP version: 4.3.2
PHP Bug Type: *General Issues
Bug description: array_merge allowing "false" as argument
Description:
------------
Code:
---------------------------------------
$array1=false;
$array2=array("test"=>"1","testing"=>"2");
$last_array=array_merge($array1,$array2);
echo "<pre>"; print_r($last_array); echo "</pre>";
---------------------------------------
Result:
---------------------------------------
Array
(
[0] =>
[test] => 1
[testing] => 2
)
---------------------------------------
Please note that not only does array_merge allow the "false" to be passed
in, but when it is, a mysterious [0] appears in the results (null array
value?)
Reproduce code:
---------------
<?php
$array1=false;
$array2=array("test"=>"1","testing"=>"2");
$last_array=array_merge($array1,$array2);
echo "<pre>"; print_r($last_array); echo "</pre>";
?>
Expected result:
----------------
Either an "invalid argument" for the "false" being passed in, or no extra
Null array value appended to the resulting array.
Actual result:
--------------
Array
(
[0] =>
[test] => 1
[testing] => 2
)
--
Edit bug report at http://bugs.php.net/?id=25494&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=25494&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=25494&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=25494&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=25494&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=25494&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=25494&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=25494&r=support
Expected behavior: http://bugs.php.net/fix.php?id=25494&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=25494&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=25494&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=25494&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25494&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=25494&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=25494&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=25494&r=gnused