Skip to content

Commit

Permalink
Fix errors with illegal string offsets.
Browse files Browse the repository at this point in the history
If $_list becomes a string notice errors are triggered when trying
to do offsets in PHP 5.4
  • Loading branch information
markstory committed Dec 28, 2011
1 parent 2cc38b5 commit e9813d7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/Cake/Utility/Set.php
Expand Up @@ -671,14 +671,17 @@ public static function insert($list, $path, $data = null) {
if (is_numeric($key) && intval($key) > 0 || $key === '0') {
$key = intval($key);
}
if ($i === $count - 1) {
if ($i === $count - 1 && is_array($_list)) {
$_list[$key] = $data;
} else {
if (!isset($_list[$key])) {
$_list[$key] = array();
}
$_list =& $_list[$key];
}
if (!is_array($_list)) {
return array();
}
}
return $list;
}
Expand Down

0 comments on commit e9813d7

Please sign in to comment.