Skip to content

Commit e497c49

Browse files
committed
fix: if uri is empty string, then it should be /
Make it the same behavior as when URIProtocol is REQUEST_URI.
1 parent 97002d0 commit e497c49

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

system/HTTP/IncomingRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ protected function parseQueryString(): string
329329
$uri = $_SERVER['QUERY_STRING'] ?? @getenv('QUERY_STRING');
330330

331331
if (trim($uri, '/') === '') {
332-
return '';
332+
return '/';
333333
}
334334

335335
if (strncmp($uri, '/', 1) === 0) {

tests/system/HTTP/IncomingRequestDetectingTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public function testPathQueryStringEmpty()
155155
$_SERVER['QUERY_STRING'] = '';
156156
$_SERVER['SCRIPT_NAME'] = '/index.php';
157157

158-
$expected = '';
158+
$expected = '/';
159159
$this->assertSame($expected, $this->request->detectPath('QUERY_STRING'));
160160
}
161161

0 commit comments

Comments
 (0)