[BUGFIX] Catch error due to invalid record in Linkvalidator scheduler task 07/53707/3
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Tue, 15 Aug 2017 12:42:06 +0000 (14:42 +0200)
committerGeorg Ringer <georg.ringer@gmail.com>
Sat, 19 Aug 2017 17:24:28 +0000 (19:24 +0200)
Resolves: #82103
Releases: master, 8.7, 7.6
Change-Id: I3e04559c05381c49ab390dc3ad0d3eebddc5a57f
Reviewed-on: https://review.typo3.org/53707
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Joerg Boesche <typo3@joergboesche.de>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
typo3/sysext/linkvalidator/Classes/Task/ValidatorTask.php
typo3/sysext/linkvalidator/Resources/Private/Language/locallang.xlf

index 0de4b10..e4f7b5d 100644 (file)
@@ -305,6 +305,7 @@ class ValidatorTask extends AbstractTask
      *
      * @param int $page Uid of the page to parse
      * @return string $pageSections Content of page section
+     * @throws \InvalidArgumentException
      */
     protected function checkPageLinks($page)
     {
@@ -321,6 +322,12 @@ class ValidatorTask extends AbstractTask
             $rootLineHidden = false;
         } else {
             $pageRow = BackendUtility::getRecord('pages', $page, '*', '', false);
+            if ($pageRow === null) {
+                throw new \InvalidArgumentException(
+                    sprintf($this->getLanguageService()->sL($this->languageFile . ':tasks.error.invalidPageUid'), $page),
+                    1502800555
+                );
+            }
             $rootLineHidden = $processor->getRootLineIsHidden($pageRow);
         }
         if (!$rootLineHidden || $modTs['checkhidden'] == 1) {
index 9af0f8c..9adf68e 100644 (file)
@@ -54,6 +54,9 @@
                        <trans-unit id="tasks.error.invalidEmailTemplateFile">
                                <source>The email template file is not existing!</source>
                        </trans-unit>
+                       <trans-unit id="tasks.error.invalidPageUid">
+                               <source>The given page id %d is invalid!</source>
+                       </trans-unit>
                </body>
        </file>
 </xliff>