[BUGFIX] pageNotFound_handling never happens 58/18558/4
authorThorben Kapp <thorben@kapp-hamburg.de>
Sat, 2 Mar 2013 11:57:08 +0000 (12:57 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Thu, 7 Mar 2013 21:33:48 +0000 (22:33 +0100)
The function \TYPO3\CMS\Core\Utility\RootlineUtility::getRecordArray
throws a \RuntimeException that should be caught in
\TYPO3\CMS\Frontend\Page\PageRepository::getRootline. If the exception
is not caught, the page-not-found-handling is never triggered.

Fixes: #44454
Releases: 6.0, 6.1
Change-Id: I3988b46ebaa8e479ed3c70017a5dda6bc5eaceac
Reviewed-on: https://review.typo3.org/18558
Reviewed-by: Thorben Kapp
Reviewed-by: Tilo Baller
Tested-by: Tilo Baller
Tested-by: Thorben Kapp
Tested-by: Vincent Mans
Reviewed-by: Wouter Wolters
Reviewed-by: Stefan Neufeind
Tested-by: Christian Futterlieb
Reviewed-by: Tomasz Krawczyk
Tested-by: Tomasz Krawczyk
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/frontend/Classes/Page/PageRepository.php

index ef1a47d..57250df 100644 (file)
@@ -557,18 +557,20 @@ class PageRepository {
         */
        public function getRootLine($uid, $MP = '', $ignoreMPerrors = FALSE) {
                $rootline = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Utility\\RootlineUtility', $uid, $MP, $this);
-               if ($ignoreMPerrors) {
-                       try {
-                               return $rootline->get();
-                       } catch (\Exception $e) {
-                               $this->error_getRootLine = $e->getMessage();
-                               if (substr($e->getMessage(), -7) == 'uid -1.') {
+               try {
+                       return $rootline->get();
+               } catch (\RuntimeException $ex) {
+                       if ($ignoreMPerrors) {
+                               $this->error_getRootLine = $ex->getMessage();
+                               if (substr($this->error_getRootLine, -7) == 'uid -1.') {
                                        $this->error_getRootLine_failPid = -1;
                                }
                                return array();
+                       /** @see \TYPO3\CMS\Core\Utility\RootlineUtility::getRecordArray */
+                       } elseif ($ex->getCode() === 1343589451) {
+                               return array();
                        }
-               } else {
-                       return $rootline->get();
+                       throw $ex;
                }
        }