8000 [HttpFoundation] tweak the Request by vicb · Pull Request #6841 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[HttpFoundation] tweak the Request #6841

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

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[HttpFoundation] tweak the Request
  • Loading branch information
vicb committed Jan 22, 2013
commit 891be26e03b8bc22210e698aa7e632018f58c799
18 changes: 6 additions & 12 deletions src/Symfony/Component/HttpFoundation/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -1588,27 +1588,21 @@ protected function prepareBasePath()
*/
protected function preparePathInfo()
{
$baseUrl = $this->getBaseUrl();

if (null === ($requestUri = $this->getRequestUri())) {
return '/';
}

$pathInfo = '/';

// Remove the query string from REQUEST_URI
if ($pos = strpos($requestUri, '?')) {
$requestUri = substr($requestUri, 0, $pos);
}
list($requestUri) = explode('?', $requestUri);

if ((null !== $baseUrl) && (false === ($pathInfo = substr($requestUri, strlen($baseUrl))))) {
// If substr() returns false then PATH_INFO is set to an empty string
return '/';
} elseif (null === $baseUrl) {
if (null === ($baseUrl = $this->getBaseUrl())) {
return $requestUri;
}

return (string) $pathInfo;
$pathInfo = substr($requestUri, strlen($baseUrl));

// If substr() returns false then PATH_INFO is set to an empty string
return false === $pathInfo ? '/' : $pathInfo;
}

/**
Expand Down
0