[BUGFIX] Make sure relative URL receives a proper host part for errorpage 62/52862/2
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 12:01:53 +0000 (14:01 +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.

Resolves: #81267
Relates: #81031
Releases: master, 8.7
Change-Id: Id9c26cba813c212438368cee031673dc59db360b
Reviewed-on: https://review.typo3.org/52862
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php

index be3d7da..3f024a2 100644 (file)
@@ -2010,7 +2010,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;