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
Prev Previous commit
[Request] more tweaks
  • Loading branch information
vicb committed Jan 22, 2013
commit 71882126328bb2fada9ebbe16ab9f49123b116f1
12 changes: 6 additions & 6 deletions src/Symfony/Component/HttpFoundation/Request.php
5E89
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ class Request
protected $format;

/**
* @var \Symfony\Component\HttpFoundation\Session\SessionInterface
* @var SessionInterface
*/
protected $session;

Expand Down Expand Up @@ -1534,12 +1534,12 @@ protected function prepareBaseUrl()
// Does the baseUrl have anything in common with the request_uri?
$requestUri = $this->getRequestUri();

if ($baseUrl && false !== $prefix = $this->getUrlencodedPrefix($requestUri, $baseUrl)) {
if ($baseUrl && null !== $prefix = $this->getUrlencodedPrefix($requestUri, $baseUrl)) {
// full $baseUrl matches
return $prefix;
}

if ($baseUrl && false !== $prefix = $this->getUrlencodedPrefix($requestUri, dirname($baseUrl))) {
if ($baseUrl && null !== $prefix = $this->getUrlencodedPrefix($requestUri, dirname($baseUrl))) {
// directory portion of $baseUrl matches
return rtrim($prefix, '/');
}
Expand Down Expand Up @@ -1658,12 +1658,12 @@ private function setPhpDefaultLocale($locale)
* @param string $string The urlencoded string
* @param string $prefix The prefix not encoded
*
* @return string|false The prefix as it is encoded in $string, or false
* @return string|null The prefix as it is encoded in $string, or null
*/
private function getUrlencodedPrefix($string, $prefix)
{
if (0 !== strpos(rawurldecode($string), $prefix)) {
return false;
return null;
}

$len = strlen($prefix);
Expand All @@ -1672,6 +1672,6 @@ private function getUrlencodedPrefix($string, $prefix)
return $match[0];
}

return false;
return null;
}
}
0