"Fixes #3689, Set::__map() array cast corrupt new object"

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6123 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2007-12-06 15:59:54 +00:00
parent 34227c0f68
commit d6c918ec95

View file

@ -215,10 +215,13 @@ class Set extends Object {
*/
function __map($array, $class, $primary = false) {
$out = new $class;
if (is_array($array)) {
foreach ($array as $key => $value) {
if (is_numeric($key) && is_array($value)) {
$out = (array)$out;
if (is_object($out)) {
$out = get_object_vars($out);
}
$out[$key] = Set::__map($value, $class, true);
} elseif ($primary === true && is_array($value)) {
$out->_name_ = $key;