From b17c4a60727ac66e05102399b4b9cdd5ce7cf725 Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Tue, 31 May 2022 08:31:38 +0200 Subject: [PATCH] Check background job type It is assumed that a job class loaded from the jobs table is an IJob, but due to programming error the job might be of another type. Then the setters will most likely fail. This patch adds an interface type check so only correct jobs are used, anything else is ignored. Signed-off-by: Christoph Wurst --- lib/private/BackgroundJob/JobList.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/private/BackgroundJob/JobList.php b/lib/private/BackgroundJob/JobList.php index fe65a1879bc..7ab86df8455 100644 --- a/lib/private/BackgroundJob/JobList.php +++ b/lib/private/BackgroundJob/JobList.php @@ -311,6 +311,10 @@ class JobList implements IJobList { } } + if (!($job instanceof IJob)) { + // This most likely means an invalid job was enqueued. We can ignore it. + return null; + } $job->setId((int) $row['id']); $job->setLastRun((int) $row['last_run']); $job->setArgument(json_decode($row['argument'], true)); -- 2.39.5