Bug Report #2945

Arr::merge() doesn't properly merge single dimension non-associative arrays

Added by Chris Smith over 4 years ago. Updated about 4 years ago.

Status:ClosedStart date:06/10/2010
Priority:NormalDue date:
Assignee:Woody Gilk% Done:

0%

Category:Core
Target version:v3.0.7
Resolution:fixed Points:

Description

Arr::merge() merges nested arrays differently to non-nested arrays, as demonstrated by the following example:

<?php

$a1 = array('x');
$a2 = array('y');

var_dump(Arr::merge($a1, $a2));

/*
array(1) {
  [0]=>
  string(1) "y" 
}
*/

/* Expecting:
array(1) {
  [0]=>
  string(1) "x" 
  [1]=>
  string(1) "y" 
}
*/

var_dump(Arr::merge(array($a1), array($a2)));

/*
array(1) {
  [0]=>
  array(2) {
    [0]=>
    string(1) "x" 
    [1]=>
    string(1) "y" 
  }
}
*/

Related issues

Related to Kohana v3.x - Patch #2518: Arr::merge bug with unassociated sub arrays, and a genera... Closed 01/25/2010
Related to Kohana v3.x - Bug Report #3642: Arr::merge() shouldn't treat non-associative arrays diffe... Closed 01/24/2011

History

#2 Updated by Woody Gilk over 4 years ago

  • Assignee set to Woody Gilk
  • Target version set to v3.0.7

#3 Updated by Woody Gilk about 4 years ago

  • Status changed from New to Needs Test
  • Resolution set to fixed

#4 Updated by Woody Gilk about 4 years ago

  • Status changed from Needs Test to Closed

Also available in: Atom PDF