Skip to content

Commit

Permalink
[BUGFIX] Fix return type of determineSiteScript
Browse files Browse the repository at this point in the history
substr returns a boolean instead of an empty string. A typecast fixes
this problem (See http://php.net/manual/de/function.substr.php#90369)

Resolves: #87387
Releases: master, 9.5
Change-Id: I14aa49c18ae028dc27b94bfdbfc3dfb643c18746
Reviewed-on: https://review.typo3.org/59612
Tested-by: TYPO3com <noreply@typo3.com>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
  • Loading branch information
urbantrout authored and maddy2101 committed Feb 1, 2019
1 parent eea77b7 commit b689a8d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion typo3/sysext/core/Classes/Http/NormalizedParams.php
Expand Up @@ -805,6 +805,6 @@ protected static function determineSitePath(string $requestHost, string $siteUrl
*/
protected static function determineSiteScript(string $requestUrl, string $siteUrl): string
{
return substr($requestUrl, strlen($siteUrl));
return (string)substr($requestUrl, strlen($siteUrl));
}
}
10 changes: 10 additions & 0 deletions typo3/sysext/core/Tests/Unit/Http/NormalizedParamsTest.php
Expand Up @@ -964,6 +964,16 @@ public function getSiteScriptReturnsExpectedPathDataProvider()
'/var/www/myInstance/Web',
'typo3/index.php?id=42&foo=bar'
],
'redirected to a sub directory' => [
'serverParams' => [
'REQUEST_URI' => '/',
'SCRIPT_NAME' => '/public/',
'HTTP_HOST' => 'www.domain.com',
],
'pathThisScript' => '/var/www/html/public/index.php',
'pathSite' => '/var/www/html/html/public',
'expected' => ''
],
];
}

Expand Down

0 comments on commit b689a8d

Please sign in to comment.