[BUGFIX] Do not fetch pages with pid < 0 in prepareCacheFlush 94/50894/3
authorSteffen Göde <steffen.goede@netresearch.de>
Thu, 11 Feb 2016 14:46:29 +0000 (15:46 +0100)
committerSusanne Moog <susanne.moog@typo3.org>
Thu, 8 Dec 2016 19:45:56 +0000 (20:45 +0100)
Do not fetch workspace related pages to prepare cache flushing.

Resolves: #73241
Releases: master,7.6,6.2
Change-Id: I49bac4f1289848ded8c74b77fc4473ef925086dd
Reviewed-on: https://review.typo3.org/50894
Reviewed-by: Oliver Hader <oliver.hader@typo3.org>
Tested-by: Oliver Hader <oliver.hader@typo3.org>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
typo3/sysext/core/Classes/DataHandling/DataHandler.php

index 02e312c..f01b341 100644 (file)
@@ -8173,14 +8173,15 @@ class DataHandler
                     ->from('pages', 'B')
                     ->where(
                         $queryBuilder->expr()->eq('A.uid', $queryBuilder->createNamedParameter($pageUid, \PDO::PARAM_INT)),
-                        $queryBuilder->expr()->eq('B.pid', $queryBuilder->quoteIdentifier('A.pid'))
+                        $queryBuilder->expr()->eq('B.pid', $queryBuilder->quoteIdentifier('A.pid')),
+                        $queryBuilder->expr()->gte('A.pid', $queryBuilder->createNamedParameter(0, \PDO::PARAM_INT))
                     )
                     ->execute();
 
                 $pid_tmp = 0;
                 while ($row_tmp = $siblings->fetch()) {
                     $pageIdsThatNeedCacheFlush[] = (int)$row_tmp['uid'];
-                    $pid_tmp = $row_tmp['pid'];
+                    $pid_tmp = (int)$row_tmp['pid'];
                     // Add children as well:
                     if ($TSConfig['clearCache_pageSiblingChildren']) {
                         $siblingChildrenQuery = $connectionPool->getQueryBuilderForTable('pages');
@@ -8201,7 +8202,9 @@ class DataHandler
                     }
                 }
                 // Finally, add the parent page as well:
-                $pageIdsThatNeedCacheFlush[] = (int)$pid_tmp;
+                if ($pid_tmp > 0) {
+                    $pageIdsThatNeedCacheFlush[] = $pid_tmp;
+                }
                 // Add grand-parent as well:
                 if ($TSConfig['clearCache_pageGrandParent']) {
                     $parentQuery = $connectionPool->getQueryBuilderForTable('pages');