Skip to content
Snippets Groups Projects
Commit e2e59fb3 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/+/69854


Tested-by: default avatarcore-ci <typo3@b13.com>
Tested-by: default avatarWouter Wolters <typo3@wouterwolters.nl>
Tested-by: default avatarBenni Mack <benni@typo3.org>
Reviewed-by: default avatarWouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: default avatarBenni Mack <benni@typo3.org>
parent 99b134d3
Branches
Tags
No related merge requests found
......@@ -147,7 +147,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);
}
}
}
......
......@@ -94,11 +94,17 @@ class PageTypeDecoratorTest extends AbstractEnhancerSiteRequestTest
)
)
;
$testSets = array_merge(
$testSets,
[$testSetForPageContainingIndexInSlug->describe() => [$testSetForPageContainingIndexInSlug]]
[
$testSetForPageContainingIndexInSlug->describe() => [
$testSetForPageContainingIndexInSlug,
],
],
);
}
return $testSets;
}
......
......@@ -126,6 +126,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"')
......@@ -156,6 +166,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'])),
];
}
......
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