From 79e7aea021ca9e71a90767e8bd8e5dd27aa804fc Mon Sep 17 00:00:00 2001
From: Oliver Hader <oliver@typo3.org>
Date: Mon, 20 Jan 2020 11:57:28 +0100
Subject: [PATCH] [BUGFIX] Avoid removing empty prefixes in mount-point
 handling

Resolves: #90156
Releases: master, 9.5
Change-Id: I237ffab4b22351d5244ee54d9bdad5068db3a2c6
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/63002
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Benni Mack <benni@typo3.org>
---
 typo3/sysext/core/Classes/Routing/PageRouter.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/typo3/sysext/core/Classes/Routing/PageRouter.php b/typo3/sysext/core/Classes/Routing/PageRouter.php
index 19e48bb2402f..156d12a95acd 100644
--- a/typo3/sysext/core/Classes/Routing/PageRouter.php
+++ b/typo3/sysext/core/Classes/Routing/PageRouter.php
@@ -392,7 +392,7 @@ class PageRouter implements RouterInterface
             // Slug prefixes are taken from the beginning of the array, where as the parts to be removed
             // Are taken from the end.
             $replacement = array_shift($slugPrefixesToAdd);
-            if (strpos($pagePath, $prefixToRemove) === 0) {
+            if ($prefixToRemove !== '' && strpos($pagePath, $prefixToRemove) === 0) {
                 $pagePath = substr($pagePath, strlen($prefixToRemove));
             }
             $pagePath = $replacement . '/' . ltrim($pagePath, '/');
-- 
GitLab