Fixes #11549: Fixed ArrayHelper::getValue() to work properly with float keys

This commit is contained in:
wanghui
2016-05-12 11:25:09 +08:00
committed by Alexander Makarov
parent b45e5fbaf2
commit 01c84e2ff2
2 changed files with 3 additions and 2 deletions

View File

@ -189,7 +189,7 @@ class BaseArrayHelper
$key = $lastKey;
}
if (is_array($array) && array_key_exists($key, $array)) {
if (is_array($array) && (isset($array[$key]) || array_key_exists($key, $array)) ) {
return $array[$key];
}
@ -203,7 +203,7 @@ class BaseArrayHelper
// it is not reliably possible to check whether a property is accessable beforehand
return $array->$key;
} elseif (is_array($array)) {
return array_key_exists($key, $array) ? $array[$key] : $default;
return (isset($array[$key]) || array_key_exists($key, $array)) ? $array[$key] : $default;
} else {
return $default;
}