[BUGFIX] Enforce int for timestamp on DateTime mapping 15/56915/2
authorNicole Cordes <typo3@cordes.co>
Thu, 10 May 2018 16:53:41 +0000 (18:53 +0200)
committerMarkus Klein <markus.klein@typo3.org>
Thu, 10 May 2018 20:51:08 +0000 (22:51 +0200)
This patch ensures using an integer value for turning a timestamp
to a DateTime object as otherwise a PHP error is thrown.

Resolves: #84962
Releases: master, 8.7, 7.6
Change-Id: I18e82c8f91f42c29c4014985a1ad11671b5a31f4
Reviewed-on: https://review.typo3.org/56915
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapper.php

index b4a85ab..dfc841f 100644 (file)
@@ -332,10 +332,9 @@ class DataMapper implements \TYPO3\CMS\Core\SingletonInterface
             $utcDateTime = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance($targetType, $value, $utcTimeZone);
             $currentTimeZone = new \DateTimeZone(date_default_timezone_get());
             return $utcDateTime->setTimezone($currentTimeZone);
-        } else {
-            // integer timestamps are local server time
-            return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance($targetType, date('c', $value));
         }
+        // integer timestamps are local server time
+        return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance($targetType, date('c', (int)$value));
     }
 
     /**