Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix errors with illegal string offsets.

If $_list becomes a string notice errors are triggered when trying
to do offsets in PHP 5.4
  • Loading branch information...
commit e9813d7a978475d5d2d264e9c8cf5526cdfbab27 1 parent 2cc38b5
@markstory markstory authored
Showing with 4 additions and 1 deletion.
  1. +4 −1 lib/Cake/Utility/Set.php
View
5 lib/Cake/Utility/Set.php
@@ -671,7 +671,7 @@ 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])) {
@@ -679,6 +679,9 @@ public static function insert($list, $path, $data = null) {
}
$_list =& $_list[$key];
}
+ if (!is_array($_list)) {
+ return array();
+ }
}
return $list;
}
Please sign in to comment.
Something went wrong with that request. Please try again.