mirror of
https://github.com/e107inc/e107.git
synced 2025-07-30 19:30:25 +02:00
fixes #3603: multiarray_sort returned only the last item in case
the array keys are numeric
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user