Commit c0c50920 authored by Stefan Bürk's avatar Stefan Bürk Committed by Benni Mack
Browse files

[BUGFIX] Remove prefixed scriptName from urlPath in PageRouter

Remove resolved scriptName with leading slash from url in
PageRouter matchRequest method.

This prevent to change the url to a invalid url if
PageTypeSuffix Decorator with .php is used and a page slugs
ends in index.

Resolves: #94537
Releases: master, 10.4, 9.5
Change-Id: I5057bb6888c228a4ca5b53d363ecf1bc7a6af1c6
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/70554


Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
parent d416cff0
......@@ -134,7 +134,7 @@ class PageRouter implements RouterInterface
if ($normalizedParams instanceof NormalizedParams) {
$scriptName = ltrim($normalizedParams->getScriptName(), '/');
if ($scriptName !== '' && strpos($urlPath, $scriptName) !== false) {
$urlPath = str_replace($scriptName, '', $urlPath);
$urlPath = str_replace('/' . $scriptName, '', $urlPath);
}
}
}
......
......@@ -124,6 +124,16 @@ class Builder
'menu.json' => 10,
],
];
$multipleTypesConfigurationDotPhp = [
'type' => 'PageType',
'default' => '.php',
'index' => 'index',
'map' => [
'.php' => 0,
'menu.json' => 10,
'.xml' => 20
],
];
return [
PageTypeDeclaration::create('null ".html"')
......@@ -154,6 +164,15 @@ class Builder
->withGenerateParameters(['&type=0'])
->withResolveArguments(['pageType' => 0])
->withVariables(Variables::create(['pathSuffix' => '/', 'index' => ''])),
PageTypeDeclaration::create('null ".php"')
->withConfiguration($multipleTypesConfigurationDotPhp)
->withResolveArguments(['pageType' => 0])
->withVariables(Variables::create(['pathSuffix' => '.php', 'index' => 'index'])),
PageTypeDeclaration::create('0 ".php"')
->withConfiguration($multipleTypesConfigurationDotPhp)
->withGenerateParameters(['&type=0'])
->withResolveArguments(['pageType' => 0])
->withVariables(Variables::create(['pathSuffix' => '.php', 'index' => 'index'])),
];
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment