Skip to content

Commit

Permalink
fixed! ticket #989, Set::extract replacing first index with an index …
Browse files Browse the repository at this point in the history
…of same key [0] one step lower
  • Loading branch information
torifat committed Apr 27, 2011
1 parent 33afe21 commit 7812223
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions cake/libs/set.php
Expand Up @@ -431,6 +431,13 @@ function extract($path, $data = null, $options = array()) {
'key' => $key,
'item' => array_keys($context['item']),
);
} elseif (($key === $token || (ctype_digit($token) && $key == $token) || $token === '.')) {
$context['trace'][] = $key;
$matches[] = array(
'trace' => $context['trace'],
'key' => $key,
'item' => $context['item'],
);
} elseif (is_array($context['item']) && array_key_exists($token, $context['item'])) {
$items = $context['item'][$token];
if (!is_array($items)) {
Expand Down Expand Up @@ -470,13 +477,6 @@ function extract($path, $data = null, $options = array()) {
'item' => $item,
);
}
} elseif (($key === $token || (ctype_digit($token) && $key == $token) || $token === '.')) {
$context['trace'][] = $key;
$matches[] = array(
'trace' => $context['trace'],
'key' => $key,
'item' => $context['item'],
);
}
}
if ($conditions) {
Expand Down

0 comments on commit 7812223

Please sign in to comment.