mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-14 06:11:35 +08:00
Fixes #11549: Fixed ArrayHelper::getValue()
to work properly with float keys
This commit is contained in:

committed by
Alexander Makarov

parent
b45e5fbaf2
commit
01c84e2ff2
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user