#46906 [Opn->Bgs]: array_unshift() changes first key
| From: | jani@php.net | Date: | Sat, 20 Dec 2008 16:53:22 +0000 |
| Subject: | #46906 [Opn->Bgs]: array_unshift() changes first key | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-132199@lists.php.net to get a copy of this message | ||
ID: 46906
Updated by: jani@php.net
Reported By: malte dot hamburg at gmx dot de
-Status: Open
+Status: Bogus
Bug Type: Arrays related
Operating System: WinXP
PHP Version: 5.2.5
New Comment:
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP --
the problem might already be fixed. Please download a new
PHP version from http://www.php.net/downloads.php
If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.
Works fine in 5.2.8.
Previous Comments:
------------------------------------------------------------------------
[2008-12-19 10:12:06] malte dot hamburg at gmx dot de
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 this bug report at http://bugs.php.net/?id=46906&edit=1