Skip to content

Commit

Permalink
Merge pull request #716 from nextcloud/backport/714/stable22
Browse files Browse the repository at this point in the history
[stable22] Fix sorting of filters on php 8.0+
  • Loading branch information
nickvergessen authored Jan 28, 2022
2 parents 81bc9a6 + a18760c commit 776affb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Controller/APIv2Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,10 @@ public function listFilters(): DataResponse {
// php 5.6 has problems with usort and objects
usort($filters, static function (array $a, array $b) {
if ($a['priority'] === $b['priority']) {
return (int) ($a['id'] > $b['id']);
return ($a['id'] > $b['id']) ? 1 : -1;
}

return (int) ($a['priority'] > $b['priority']);
return $a['priority'] - $b['priority'];
});

return new DataResponse($filters);
Expand Down

0 comments on commit 776affb

Please sign in to comment.