Bug #54011 [Opn->Bgs]: array_merge_recursive does not use free numeric keys

From: Date: Mon, 28 Feb 2011 14:59:32 +0000
Subject: Bug #54011 [Opn->Bgs]: array_merge_recursive does not use free numeric keys
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-159102@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=54011&edit=1

 ID:                 54011
 Updated by:         iliaa@php.net
 Reported by:        j dot henge-ernst at interexa dot de
 Summary:            array_merge_recursive does not use free numeric keys
-Status:             Open
+Status:             Bogus
 Type:               Bug
 Package:            Arrays related
 Operating System:   linux
 PHP Version:        5.3.5
 Block user comment: N
 Private report:     N

 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php




Previous Comments:
------------------------------------------------------------------------
[2011-02-14 09:12:44] j dot henge-ernst at interexa dot de

Description:
------------
If you use array_merge_recursive to join arrays which have different
numeric keys, free keys are nor used if the later array has a key which
is below the first/highest key.

Test script:
---------------
var_dump(array_merge_recursive(
array("a" => array(5 => "7")),
array("a" => array(3 => "8"))
));'


Expected result:
----------------
array(1) {
  ["a"]=>
  array(2) {
    [3]=>
    string(1) "8"
    [5]=>
    string(1) "7"
  }
}


Actual result:
--------------
array(1) {
  ["a"]=>
  array(2) {
    [5]=>
    string(1) "7"
    [6]=>
    string(1) "8"
  }
}



------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=54011&edit=1


Thread (2 messages)

« previous php.bugs (#159102) next »