[BUGFIX] Fix fatal in SchedulerModuleController on some DB drivers 85/58285/4
authorChristian Kuhn <lolli@schwarzbu.ch>
Sat, 15 Sep 2018 13:55:01 +0000 (15:55 +0200)
committerGeorg Ringer <georg.ringer@gmail.com>
Sat, 15 Sep 2018 17:02:31 +0000 (19:02 +0200)
Some DB drivers like pdo_mysql and our postgres flavor return
values from DB always as string. Classes with enabled strict_types
then tend to fail if those values that should be integers but are
strings are fed to functions that accept integers only. The patch
fixes two places in SchedulerModuleController where a db value
is directly sent to date(), which needs an int as second argument.

Resolves: #86263
Releases: master
Change-Id: I00ce0425774762fef235373f643f8b69bdd072bb
Reviewed-on: https://review.typo3.org/58285
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
typo3/sysext/scheduler/Classes/Controller/SchedulerModuleController.php

index 48ac1a7..d6a181e 100644 (file)
@@ -912,7 +912,7 @@ class SchedulerModuleController
                 $tasks[$taskIndex]['tasks'][$recordIndex]['class'] = $class;
                 // Assemble information about last execution
                 if (!empty($schedulerRecord['lastexecution_time'])) {
-                    $lastExecution = date($dateFormat, $schedulerRecord['lastexecution_time']);
+                    $lastExecution = date($dateFormat, (int)$schedulerRecord['lastexecution_time']);
                     if ($schedulerRecord['lastexecution_context'] === 'CLI') {
                         $context = $this->getLanguageService()->getLL('label.cron');
                     } else {
@@ -950,7 +950,7 @@ class SchedulerModuleController
                     if ($isRunning || $schedulerRecord['disable']) {
                         $nextDate = '-';
                     } else {
-                        $nextDate = date($dateFormat, $schedulerRecord['nextexecution']);
+                        $nextDate = date($dateFormat, (int)$schedulerRecord['nextexecution']);
                         if (empty($schedulerRecord['nextexecution'])) {
                             $nextDate = $this->getLanguageService()->getLL('none');
                         } elseif ($schedulerRecord['nextexecution'] < $GLOBALS['EXEC_TIME']) {