mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
"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:
parent
34227c0f68
commit
d6c918ec95
1 changed files with 4 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue