From c7996f05a4d101c345724b6b302256cd05657713 Mon Sep 17 00:00:00 2001 From: Lukas Niestroj Date: Mon, 5 Jul 2021 12:39:14 +0200 Subject: [PATCH] [BUGFIX] Prevent method call on invalid task in scheduler Resolves: #94355 Releases: master, 10.4 Change-Id: Ibff208cf5e2165664a8e03952d207ece76be31e3 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/70254 Tested-by: core-ci Tested-by: Christian Kuhn Reviewed-by: Christian Kuhn --- typo3/sysext/scheduler/Classes/Scheduler.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/typo3/sysext/scheduler/Classes/Scheduler.php b/typo3/sysext/scheduler/Classes/Scheduler.php index edcfb6670efc..087454a5df28 100644 --- a/typo3/sysext/scheduler/Classes/Scheduler.php +++ b/typo3/sysext/scheduler/Classes/Scheduler.php @@ -346,13 +346,13 @@ public function fetchTask($uid = 0) } /** @var Task\AbstractTask $task */ $task = unserialize($row['serialized_task_object']); - if ($task->getTaskGroup() === null) { - // Fix invalid task_group=NULL settings in order to avoid exceptions when saving on PostgreSQL - $task->setTaskGroup(0); - } if ($this->isValidTaskObject($task)) { // The task is valid, return it $task->setScheduler(); + if ($task->getTaskGroup() === null) { + // Fix invalid task_group=NULL settings in order to avoid exceptions when saving on PostgreSQL + $task->setTaskGroup(0); + } } else { // Forcibly set the disable flag to 1 in the database, // so that the task does not come up again and again for execution