1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-05 14:17:49 +02:00

Merge pull request #3642 from SimSync/fix_3603

fixes #3603: multiarray_sort returned only the last item in case the array keys are numeric
This commit is contained in:
Cameron
2019-01-24 17:21:28 -08:00
committed by GitHub

View File

@@ -410,9 +410,20 @@ if (!function_exists('multiarray_sort'))
foreach($sort_values as $arr_key=>$arr_val) foreach($sort_values as $arr_key=>$arr_val)
{ {
$key = is_numeric($arr_key) ? "" : $arr_key; // retain assoc-array keys. // 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]; $sorted_arr[$key] = $array[$arr_key];
} }
}
return $sorted_arr; return $sorted_arr;
} }
} }