php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19241 array_pop reorders index
Submitted: 2002-09-05 03:50 UTC Modified: 2002-09-05 04:00 UTC
From: oliver dot neumann at newidentity dot de Assigned:
Status: Closed Package: Arrays related
PHP Version: 4.1.2 OS: Linux
Private report: No CVE-ID: None
 [2002-09-05 03:50 UTC] oliver dot neumann at newidentity dot de
Lets say we have an array :

-x-x-x-
Array (
  [3494374378] => "test1",
  [5895584478] => "test2",
  [6472593387] => "test3",
  [7843747484] => "test4",
  [8340983427] => "test5",
  [9240982302] => "test6"
)
-x-x-x-

after doing array_pop, we now have :

-x-x-x-
Array (
  [0] => "test1",
  [1] => "test2",
  [2] => "test3",
  [3] => "test4",
  [4] => "test5"
)
-x-x-x-

So ... all keys are LOST!

Is this function BUGGY? How to maintain the keys?

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-09-05 04:00 UTC] derick@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.

This is fixed in CVS, but only for 4.3.0+

Derick
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 19 15:01:31 2024 UTC