Hash::flatten has a bug which causes an endless loop when try to flatten an integer key.
Probably the $data array pointer won't reset itself when doing:

$data = $element

and

list($data, $path) = array_pop($stack)

The solution is to reset the pointer after the assignments.
This commit is contained in:
Marco Tisi 2013-01-08 11:49:52 +01:00
parent 3f21d09c1d
commit 8af76a5662

View file

@ -532,6 +532,7 @@ class Hash {
$stack[] = array($data, $path);
}
$data = $element;
reset($data);
$path .= $key . $separator;
} else {
$result[$path . $key] = $element;
@ -539,6 +540,7 @@ class Hash {
if (empty($data) && !empty($stack)) {
list($data, $path) = array_pop($stack);
reset($data);
}
}
return $result;