protected function Request::preparePathInfo

Prepares the path info.

Return value

string path info

1 call to Request::preparePathInfo()
Request::getPathInfo in drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Request.php
Returns the path being requested relative to the executed script.
1 method overrides Request::preparePathInfo()
ApacheRequest::preparePathInfo in drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ApacheRequest.php
Prepares the path info.

File

drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Request.php, line 1430

Class

Request
Request represents an HTTP request.

Namespace

Symfony\Component\HttpFoundation

Code

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);
  }
  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) {
    return $requestUri;
  }
  return (string) $pathInfo;
}