-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpFoundation] Ensure path info has a leading slash #40750
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 7.4
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -265,6 +265,27 @@ public function testCreate() | |
$this->assertEquals('http://test.com/foo', $request->getUri()); | ||
} | ||
|
||
public function testIndexDotPhpPathInfo() | ||
{ | ||
// assume no rewrite rule: /index.php --> / | ||
// assume index.php is a real file. | ||
// assume rewrite rule passes all requests not referring directly to | ||
// files in the filesystem to index.php. | ||
$request = Request::create('http://test.com/index.php.php', 'GET', [], [], [], | ||
[ | ||
'DOCUMENT_ROOT' => '/var/www/www.test.com', | ||
'SCRIPT_FILENAME' => '/var/www/www.test.com/index.php', | ||
'SCRIPT_NAME' => '/index.php', | ||
'PHP_SELF' => '/index.php', | ||
]); | ||
$this->assertEquals('http://test.com/index.php/.php', $request->getUri()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that case looks wrong to me though, as that would be a different Uri that the input There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What should the uri be though? If you make a request to index.php/something or /something in this situation you'd want the path info to be /something. And it is. I think this is a special edge case because of the way htaccess rules work for Drupal (and probably a number of other projects). The relevant parts of our rule is:
I think we should treat a request to index.phpSOMETHING as a request to SOMETHING - regardless of whether SOMETHING starts with a /... which means we need to duplicate the logic of when there is no base path... This is just above the code I've added.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For |
||
$this->assertEquals('/.php', $request->getPathInfo()); | ||
$this->assertEquals('', $request->getQueryString()); | ||
$this->assertEquals(80, $request->getPort()); | ||
$this->assertEquals('test.com', $request->getHttpHost()); | ||
$this->assertFalse($request->isSecure()); | ||
} | ||
|
||
public function testCreateWithRequestUri() | ||
{ | ||
$request = Request::create('http://test.com:80/foo'); | ||
|
Uh oh!
There was an error while loading. Please reload this page.