updating Set::map() handling of deeply nested arrays, fixes #3809, thanks to speedmax for an updated test case.

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6320 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
gwoo 2008-01-04 01:32:52 +00:00
parent 83b6be9d60
commit 22cc25e9c5
2 changed files with 10 additions and 3 deletions

View file

@ -226,7 +226,7 @@ class Set extends Object {
$primary = true;
}
if (is_numeric($key)) {
if (is_object($out) && is_array($value)) {
if (is_object($out)) {
$out = get_object_vars($out);
}
$out[$key] = Set::__map($value, $class, true);
@ -234,7 +234,7 @@ class Set extends Object {
$out->_name_ = $key;
$primary = false;
foreach($value as $key2 => $value2) {
$out->{$key2} = Set::__map($value2, $class);
$out->{$key2} = Set::__map($value2, true);
}
} else {
$out->{$key} = Set::__map($value, $class);

View file

@ -691,6 +691,10 @@ class SetTest extends UnitTestCase {
'X-Original-Transfer-Encoding' => "chunked",
'Content-Length' => "50210",
),
'meta' => array(
'keywords' => array('testing','tests'),
'description'=>'describe me',
),
'get_vars' => '',
'post_vars' => array(),
'cookies' => array('PHPSESSID' => "dde9896ad24595998161ffaf9e0dbe2d"),
@ -714,6 +718,10 @@ class SetTest extends UnitTestCase {
'X-Original-Transfer-Encoding' => "chunked",
'Content-Length' => "50210",
),
'meta' => array(
'keywords' => array('testing','tests'),
'description'=>'describe me',
),
'get_vars' => '',
'post_vars' => array(),
'cookies' => array('PHPSESSID' => "dde9896ad24595998161ffaf9e0dbe2d"),
@ -969,7 +977,6 @@ class SetTest extends UnitTestCase {
$result = Set::reverse($xml);
$expected = array('Data' => array('Post' => array('title' => 'Title of this post', 'description' => 'cool')));
$this->assertEqual($result, $expected);
}
}
?>