mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-09-07 12:02:41 +00:00
Closes ticket #3080 in CakePHP Lighthouse (http://cakephp.lighthouseapp.com/projects/42648/tickets/3080-hashflatten-endless-loop-on-single-0-int-keys).
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:
parent
3f21d09c1d
commit
8af76a5662
1 changed files with 2 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue