diff --git a/system/Helpers/array_helper.php b/system/Helpers/array_helper.php index e4408bc60368..9b88cc2a0e0f 100644 --- a/system/Helpers/array_helper.php +++ b/system/Helpers/array_helper.php @@ -45,11 +45,15 @@ function dot_array_search(string $index, array $array) */ function _array_search_dot(array $indexes, array $array) { + // If index is empty, returns null. + if ($indexes === []) { + return null; + } + // Grab the current index - $currentIndex = $indexes ? array_shift($indexes) : null; - $intCurrentIndex = (int) $currentIndex; + $currentIndex = array_shift($indexes); - if (empty($currentIndex) && $intCurrentIndex !== 0 || (! isset($array[$currentIndex]) && $currentIndex !== '*')) { + if (! isset($array[$currentIndex]) && $currentIndex !== '*') { return null; }