[BUGFIX] Make sure relative URL receives a proper host part for errorpage 59/52859/5
authorAnja Leichsenring <anja.leichsenring@typo3.com>
Fri, 19 May 2017 09:46:40 +0000 (11:46 +0200)
committerBenni Mack <benni@typo3.org>
Fri, 19 May 2017 11:16:45 +0000 (13:16 +0200)
If the code given for PageNotFound_handling is a relative URL, the host
determination gets skipped, resulting in a redirect of the markup of
the page instead a proper redirect.

Change-Id: Id9c26cba813c212438368cee031673dc59db360b
Resolves: #81267
Relates: #81031
Releases: master, 8.7
Reviewed-on: https://review.typo3.org/52859
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Mathias Brodala <mbrodala@pagemachine.de>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php

index 0f957d1..92c8752 100644 (file)
@@ -1949,7 +1949,8 @@ class TypoScriptFrontendController
         } elseif ($code !== '') {
             // Check if URL is relative
             $url_parts = parse_url($code);
-            if ($url_parts['host'] === '') {
+            // parse_url could return an array without the key "host", the empty check works better than strict check
+            if (empty($url_parts['host'])) {
                 $url_parts['host'] = GeneralUtility::getIndpEnv('HTTP_HOST');
                 if ($code[0] === '/') {
                     $code = GeneralUtility::getIndpEnv('TYPO3_REQUEST_HOST') . $code;