mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-14 00:24:40 +00:00
MVC - ApiControllerBase : safeguard multi_sort in searchRecordsetBase() when non-existing column is passed
ref : https://forum.opnsense.org/index.php?topic=28043.msg136169#msg136169
This commit is contained in:
parent
26f72adaf6
commit
4ec9ea3d1a
@ -84,10 +84,14 @@ class ApiControllerBase extends ControllerRoot
|
||||
$keys = array_keys($this->request->getPost('sort'));
|
||||
$order = $this->request->getPost('sort')[$keys[0]];
|
||||
$keys = array_column($formatted, $keys[0]);
|
||||
array_multisort($keys, $order == 'asc' ? SORT_ASC : SORT_DESC, $sort_flags, $formatted);
|
||||
if (!empty($keys)) {
|
||||
array_multisort($keys, $order == 'asc' ? SORT_ASC : SORT_DESC, $sort_flags, $formatted);
|
||||
}
|
||||
} elseif (!empty($defaultSort)) {
|
||||
$keys = array_column($formatted, $defaultSort);
|
||||
array_multisort($keys, SORT_ASC, $sort_flags, $formatted);
|
||||
if (!empty($keys)) {
|
||||
array_multisort($keys, SORT_ASC, $sort_flags, $formatted);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user