Fix a couple of bugs in the Arr class.

This commit is contained in:
Taylor Otwell 2011-08-15 15:05:57 -05:00
parent 4d38ec0279
commit cd90845acc
1 changed files with 2 additions and 2 deletions

View File

@ -20,7 +20,7 @@ public static function get($array, $key, $default = null)
foreach (explode('.', $key) as $segment)
{
if ( ! array_key_exists($segment, $array))
if ( ! is_array($array) or ! array_key_exists($segment, $array))
{
return is_callable($default) ? call_user_func($default) : $default;
}
@ -52,7 +52,7 @@ public static function set(&$array, $key, $value)
{
$key = array_shift($keys);
if ( ! isset($array[$key]))
if ( ! isset($array[$key]) or ! is_array($array[$key]))
{
$array[$key] = array();
}