From:             malte dot hamburg at gmx dot de
Operating system: WinXP
PHP version:      5.2CVS-2008-12-19 (CVS)
PHP Bug Type:     Arrays related
Bug description:  "array_unshift" changes first key

Description:
------------
After using "array_unshift" (and the first key is numeric) the first (old)
key of the array has  changed.

We use PHP 5.2.5 (API 20041225)


Reproduce code:
---------------
$test = array("4711" => "4711", "Hello" => "Hello");
print_r($test);
array_unshift($test, array(null => "New text"));
print_r($test);

Expected result:
----------------
Array ( [4711] => 4711 [Hello] => Hello ) 
Array ( [0] => Array ( [] => New text ) [1] => 4711 [Hello] => Hello ) 

Actual result:
--------------
Array ( [4711] => 4711 [Hello] => Hello ) 
Array ( [0] => Array ( [] => New text ) [4711] => 4711 [Hello] => Hello ) 

-- 
Edit bug report at http://bugs.php.net/?id=46906&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        
http://bugs.php.net/fix.php?id=46906&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        
http://bugs.php.net/fix.php?id=46906&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        
http://bugs.php.net/fix.php?id=46906&r=trysnapshot60
Fixed in CVS:                        
http://bugs.php.net/fix.php?id=46906&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=46906&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=46906&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=46906&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=46906&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=46906&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=46906&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=46906&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=46906&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=46906&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=46906&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=46906&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=46906&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=46906&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=46906&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=46906&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=46906&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=46906&r=mysqlcfg

Reply via email to