From ed01cb03061f63922ff0aafbeae22d1a009d051c Mon Sep 17 00:00:00 2001 From: jvoisin Date: Sat, 29 May 2021 13:58:33 +0200 Subject: [PATCH] Fix a php8 warning The usort's callback must return values in {-1, 0, 1} and not a boolean, since this behaviour is deprecated. This should also fix the following warning: "Error: usort(): Returning bool from comparison function is deprecated, return an integer less than, equal to, or greater than zero at /var/www/nextcloud/lib/public/AppFramework/Http/Template/PublicTemplateResponse.php#101" This partially addresses #25806 Signed-off-by: jvoisin --- .../AppFramework/Http/Template/PublicTemplateResponse.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/public/AppFramework/Http/Template/PublicTemplateResponse.php b/lib/public/AppFramework/Http/Template/PublicTemplateResponse.php index 84c940d422..fd8d26c6fe 100644 --- a/lib/public/AppFramework/Http/Template/PublicTemplateResponse.php +++ b/lib/public/AppFramework/Http/Template/PublicTemplateResponse.php @@ -97,7 +97,10 @@ class PublicTemplateResponse extends TemplateResponse { $this->headerActions[] = $action; } usort($this->headerActions, function (IMenuAction $a, IMenuAction $b) { - return $a->getPriority() > $b->getPriority(); + if ($a->getPriority() == $b->getPriority()) { + return 0; + } + return ($a->getPriority() > $b->getPriority()) ? -1 : 1; }); }