[BUGFIX] Handle empty absRefPrefix in PageLinkBuilder 16/56616/3
authorOliver Hader <oliver@typo3.org>
Mon, 9 Apr 2018 18:11:50 +0000 (20:11 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Mon, 9 Apr 2018 18:58:22 +0000 (20:58 +0200)
Using empty values for absRefPrefix as needle in strpos() will
throw a warning. In order to avoid that, it's now checked more
explicitly if the prefixed slash originally was absRefPrefix.

Resolves: #84676
Releases: master
Change-Id: I7515e8d283b2d68e39f7a0451432d453471088f0
Reviewed-on: https://review.typo3.org/56616
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/frontend/Classes/Typolink/PageLinkBuilder.php

index 363c31e..7c973a7 100644 (file)
@@ -559,7 +559,7 @@ class PageLinkBuilder extends AbstractTypolinkBuilder
         // $totalUri contains /index.php for legacy URLs, as previously "it was index.php"
         // In case an URI has is prefixed with "/" which is not the absRefPrefix, remove it.
         // this might change in the future
-        if (strpos($totalUrl, '/index.php') === 0 && strpos($totalUrl, $absRefPrefix) !== 0) {
+        if (strpos($totalUrl, '/index.php') === 0 && $absRefPrefix !== '/') {
             $totalUrl = substr($totalUrl, 1);
         }