diff --git a/core/lib/Drupal/Core/Routing/RequestContext.php b/core/lib/Drupal/Core/Routing/RequestContext.php index fd0afc9..4f64a79 100644 --- a/core/lib/Drupal/Core/Routing/RequestContext.php +++ b/core/lib/Drupal/Core/Routing/RequestContext.php @@ -11,15 +11,34 @@ use Symfony\Component\Routing\RequestContext as BaseRequestContext; /** - * Extends Symfony's RequestContext to populate pathInfo from _system_path. + * Extends Symfony's RequestContext to also provide system_path. */ class RequestContext extends BaseRequestContext { + /** + * The requested internal path, with path aliases converted. + * + * @var string + */ + protected $systemPath; + public function fromRequest(Request $request) { parent::fromRequest($request); if ($request->attributes->has('_system_path')) { - $this->setPathInfo('/' . $request->attributes->get('_system_path')); + $this->systemPath = '/' . $request->attributes->get('_system_path'); + } + else { + $this->systemPath = $this->getPathInfo(); } } + /** + * The requested internal path. + * + * @return string + */ + public function getSystemPath() { + return $this->systemPath; + } + } diff --git a/core/lib/Drupal/Core/Routing/RouteProvider.php b/core/lib/Drupal/Core/Routing/RouteProvider.php index 56a3850..398f242 100644 --- a/core/lib/Drupal/Core/Routing/RouteProvider.php +++ b/core/lib/Drupal/Core/Routing/RouteProvider.php @@ -105,7 +105,7 @@ public function getRouteCollectionForRequest(Request $request) { $context = new RequestContext(); $context->fromRequest($request); - $path = rtrim($context->getPathInfo(), '/'); + $path = rtrim($context->getSystemPath(), '/'); $collection = $this->getRoutesByPath($path); diff --git a/core/lib/Drupal/Core/Routing/UrlMatcher.php b/core/lib/Drupal/Core/Routing/UrlMatcher.php index 6f22cf6..def7b25 100644 --- a/core/lib/Drupal/Core/Routing/UrlMatcher.php +++ b/core/lib/Drupal/Core/Routing/UrlMatcher.php @@ -29,7 +29,7 @@ public function finalMatch(RouteCollection $collection, Request $request) { $context = new RequestContext(); $context->fromRequest($request); $this->setContext($context); - $path = rtrim($context->getPathInfo(), '/'); + $path = rtrim($context->getSystemPath(), '/'); return $this->match($path); } diff --git a/core/modules/user/lib/Drupal/user/EventSubscriber/MaintenanceModeSubscriber.php b/core/modules/user/lib/Drupal/user/EventSubscriber/MaintenanceModeSubscriber.php index a881154..ca5b425 100644 --- a/core/modules/user/lib/Drupal/user/EventSubscriber/MaintenanceModeSubscriber.php +++ b/core/modules/user/lib/Drupal/user/EventSubscriber/MaintenanceModeSubscriber.php @@ -30,7 +30,7 @@ public function onKernelRequestMaintenance(GetResponseEvent $event) { $site_status = $request->attributes->get('_maintenance'); $request_context = new RequestContext(); $request_context->fromRequest($request); - $path = trim($request_context->getPathInfo(), '/'); + $path = trim($request_context->getSystemPath(), '/'); if ($site_status == MENU_SITE_OFFLINE) { // If the site is offline, log out unprivileged users. if ($user->isAuthenticated() && !$user->hasPermission('access site in maintenance mode')) {