From bcd9853c6bfce349763fb9b268fed0e3465eb13f Mon Sep 17 00:00:00 2001 From: Achim Ennenbach Date: Thu, 24 Jan 2019 16:54:17 +0100 Subject: [PATCH] fixes #3603: multiarray_sort returned only the last item in case the array keys are numeric --- e107_handlers/core_functions.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/e107_handlers/core_functions.php b/e107_handlers/core_functions.php index 06f9520bd..9c65b1e5b 100644 --- a/e107_handlers/core_functions.php +++ b/e107_handlers/core_functions.php @@ -410,8 +410,19 @@ if (!function_exists('multiarray_sort')) foreach($sort_values as $arr_key=>$arr_val) { - $key = is_numeric($arr_key) ? "" : $arr_key; // retain assoc-array keys. - $sorted_arr[$key] = $array[$arr_key]; + // Issue #3603: multiarray_sort returns only the last array item in case the $arr_key is numeric +// $key = is_numeric($arr_key) ? count($sorted_arr) : $arr_key; // retain assoc-array keys. +// $sorted_arr[$key] = $array[$arr_key]; + + if (is_numeric($arr_key)) + { + $sorted_arr[] = $array[$arr_key]; + } + else + { + $sorted_arr[$key] = $array[$arr_key]; + } + } return $sorted_arr; }