[BUGFIX] Prevent various PHP notices 19/59919/2
authorMarkus Klein <markus.klein@typo3.org>
Fri, 8 Mar 2019 00:52:41 +0000 (01:52 +0100)
committerBenni Mack <benni@typo3.org>
Fri, 8 Mar 2019 08:58:41 +0000 (09:58 +0100)
Resolves: #87862
Releases: master, 9.5
Change-Id: I7a48f155c031a9213034def7b39905cf9007ec50
Reviewed-on: https://review.typo3.org/c/59919
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Benni Mack <benni@typo3.org>
typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php
typo3/sysext/frontend/Classes/Middleware/TimeTrackerInitialization.php

index 175c482..afd95e8 100644 (file)
@@ -2621,7 +2621,7 @@ class TypoScriptFrontendController implements LoggerAwareInterface
         $this->releaseLock('pagesection');
 
         // Setting cache_timeout_default. May be overridden by PHP include scripts.
-        $this->cacheTimeOutDefault = (int)$this->config['config']['cache_period'];
+        $this->cacheTimeOutDefault = (int)($this->config['config']['cache_period'] ?? 0);
         // Page is generated
         $this->no_cacheBeforePageGen = $this->no_cache;
     }
@@ -3495,7 +3495,7 @@ class TypoScriptFrontendController implements LoggerAwareInterface
                 // No cache period set at all, so we take one day (60*60*24 seconds = 86400 seconds):
                 $cacheTimeout = 86400;
             }
-            if ($this->config['config']['cache_clearAtMidnight']) {
+            if (!empty($this->config['config']['cache_clearAtMidnight'])) {
                 $timeOutTime = $GLOBALS['EXEC_TIME'] + $cacheTimeout;
                 $midnightTime = mktime(0, 0, 0, date('m', $timeOutTime), date('d', $timeOutTime), date('Y', $timeOutTime));
                 // If the midnight time of the expire-day is greater than the current time,
index 84823f6..fe67cb8 100644 (file)
@@ -41,7 +41,7 @@ class TimeTrackerInitialization implements MiddlewareInterface
         $configuredCookieName = trim($GLOBALS['TYPO3_CONF_VARS']['BE']['cookieName']) ?: 'be_typo_user';
         $timeTracker = GeneralUtility::makeInstance(
             TimeTracker::class,
-            $request->getCookieParams()[$configuredCookieName] ? true : false
+            !empty($request->getCookieParams()[$configuredCookieName])
         );
         $timeTracker->start();
         $timeTracker->push('');