From a8839517fe20402fbfecb340d5f1b2ddbaa21227 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 14 May 2022 06:36:43 +0000 Subject: [PATCH] Fix workerqueue entries with wrong priority --- src/Core/Worker.php | 2 +- src/Model/Item.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Core/Worker.php b/src/Core/Worker.php index 45811d40a7..e29cf765a4 100644 --- a/src/Core/Worker.php +++ b/src/Core/Worker.php @@ -1322,7 +1322,7 @@ class Worker $found = DBA::exists('workerqueue', ['command' => $command, 'parameter' => $parameters, 'done' => false]); $added = 0; - if (!in_array($priority, PRIORITIES)) { + if (!is_int($priority) || !in_array($priority, PRIORITIES)) { Logger::warning('Invalid priority', ['priority' => $priority, 'command' => $command, 'callstack' => System::callstack(20)]); $priority = PRIORITY_MEDIUM; } diff --git a/src/Model/Item.php b/src/Model/Item.php index 492442188a..a1cccb2544 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -725,7 +725,7 @@ class Item return GRAVITY_UNKNOWN; // Should not happen } - public static function insert(array $item, bool $notify = false, bool $post_local = true) + public static function insert(array $item, int $notify = 0, bool $post_local = true) { $orig_item = $item; @@ -739,7 +739,7 @@ class Item $item['protocol'] = Conversation::PARCEL_DIRECT; $item['direction'] = Conversation::PUSH; - if (in_array($notify, PRIORITIES)) { + if (is_int($notify) && in_array($notify, PRIORITIES)) { $priority = $notify; } } else {