[BUGFIX] Cast lastMod property to int 82/59682/4
authorRichard Haeser <richard@maxserv.com>
Mon, 11 Feb 2019 19:24:39 +0000 (20:24 +0100)
committerGeorg Ringer <georg.ringer@gmail.com>
Wed, 13 Feb 2019 07:19:56 +0000 (08:19 +0100)
To prevent type mismatches when using pdo_mysql as the database driver,
the data for the lastMod field is cast to an integer.

Resolves: #87689
Releases: master, 9.5
Change-Id: I696f62a3b08d464708c9e1ab9edb4c733835f475
Reviewed-on: https://review.typo3.org/59682
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Tested-by: TYPO3com <noreply@typo3.com>
Reviewed-by: Björn Jacob <bjoern.jacob@tritum.de>
Reviewed-by: Guido Schmechel <guido.schmechel@brandung.de>
Reviewed-by: André Schließer <andy.schliesser@gmail.com>
Reviewed-by: Jörg Bösche <typo3@joergboesche.de>
Reviewed-by: Josef Glatz <josef.glatz@typo3.org>
Tested-by: Josef Glatz <josef.glatz@typo3.org>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
typo3/sysext/seo/Classes/XmlSitemap/AbstractXmlSitemapDataProvider.php
typo3/sysext/seo/Classes/XmlSitemap/RecordsXmlSitemapDataProvider.php

index 70cd3aa..985ca20 100644 (file)
@@ -104,7 +104,7 @@ abstract class AbstractXmlSitemapDataProvider implements XmlSitemapDataProviderI
         $lastMod = 0;
         foreach ($this->items as $item) {
             if ((int)$item['lastMod'] > $lastMod) {
-                $lastMod = $item['lastMod'];
+                $lastMod = (int)$item['lastMod'];
             }
         }
 
index b0e4fab..0b79dcd 100644 (file)
@@ -99,7 +99,7 @@ class RecordsXmlSitemapDataProvider extends AbstractXmlSitemapDataProvider
         foreach ($rows as $row) {
             $this->items[] = [
                 'data' => $row,
-                'lastMod' => $row[$lastModifiedField]
+                'lastMod' => (int)$row[$lastModifiedField]
             ];
         }
     }