1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-30 11:20:25 +02:00

fixes #3603: multiarray_sort returned only the last item in case

the array keys are numeric
This commit is contained in:
Achim Ennenbach
2019-01-24 16:54:17 +01:00
parent 9c4dbcab91
commit bcd9853c6b

View File

@@ -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;
}