Skip to content

Commit 06cc6f4

Browse files
JanTvrdikdg
authored andcommitted
RequestFactory: script path detection is case-sensitive (BC break)
1 parent 414bfb6 commit 06cc6f4

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/Http/RequestFactory.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,8 @@ public function createHttpRequest()
8989
$url->setQuery(isset($tmp[1]) ? $tmp[1] : '');
9090

9191
// detect script path
92-
$path = strtolower($path) . '/';
92+
$path .= '/';
9393
$script = isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] . '/' : '/';
94-
$script = strtolower($script);
9594
$max = min(strlen($path), strlen($script));
9695
for ($i = 0; $i < $max; $i++) {
9796
if ($path[$i] !== $script[$i]) {

tests/Http/RequestFactory.scriptPath.phpt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ test(function() use ($factory) {
2626
test(function() use ($factory) {
2727
$_SERVER = array(
2828
'REQUEST_URI' => '/projects/modules-usage/www/default/add-item',
29-
'SCRIPT_NAME' => '/projects/Modules-Usage/www/index.php',
29+
'SCRIPT_NAME' => '/projects/modules-usage/www/index.php',
3030
);
3131

3232
Assert::same( '/projects/modules-usage/www/', $factory->createHttpRequest()->getUrl()->getScriptPath() );
@@ -93,3 +93,13 @@ test(function() use ($factory) {
9393

9494
Assert::same( '/configuration/', $factory->createHttpRequest()->getUrl()->getScriptPath() );
9595
});
96+
97+
98+
test(function() use ($factory) {
99+
$_SERVER = array(
100+
'REQUEST_URI' => '/blog/WWW/',
101+
'SCRIPT_NAME' => '/blog/www/index.php',
102+
);
103+
104+
Assert::same( '/blog/', $factory->createHttpRequest()->getUrl()->getScriptPath() );
105+
});

0 commit comments

Comments
 (0)