diff --git a/core/lib/Drupal/Core/EventSubscriber/RedirectLeadingSlashes.php b/core/lib/Drupal/Core/EventSubscriber/RedirectLeadingSlashes.php index 5ed1413..593eaed 100644 --- a/core/lib/Drupal/Core/EventSubscriber/RedirectLeadingSlashes.php +++ b/core/lib/Drupal/Core/EventSubscriber/RedirectLeadingSlashes.php @@ -21,7 +21,7 @@ class RedirectLeadingSlashes implements EventSubscriberInterface { * Redirects paths starting with multiple slashes to a single slash. * * @param \Symfony\Component\HttpKernel\Event\GetResponseEvent $event - * The Event to process. + * The GetResponseEvent to process. */ public function redirect(GetResponseEvent $event) { $request = $event->getRequest(); @@ -36,13 +36,10 @@ public function redirect(GetResponseEvent $event) { } /** - * Registers the methods in this class that should be listeners. - * - * @return array - * An array of event listener definitions. + * {@inheritdoc} */ static function getSubscribedEvents() { - $events[KernelEvents::REQUEST][] = array('redirect', 1000); + $events[KernelEvents::REQUEST][] = ['redirect', 1000]; return $events; } diff --git a/core/modules/system/src/Tests/Routing/RouterTest.php b/core/modules/system/src/Tests/Routing/RouterTest.php index a5b544e..e8a46ff 100644 --- a/core/modules/system/src/Tests/Routing/RouterTest.php +++ b/core/modules/system/src/Tests/Routing/RouterTest.php @@ -254,13 +254,13 @@ public function testRouterUninstallInstall() { * Ensure that multiple leading slashes are redirected. */ public function testLeadingSlashes() { - // Confirm that the router can get to a controller. $request = $this->container->get('request_stack')->getCurrentRequest(); $url = $request->getUriForPath('//router_test/test1'); $this->drupalGet($url); $this->assertEqual(1, $this->redirectCount, $url . " redirected to " . $this->url); $this->assertUrl($this->container->get('url_generator')->generateFromPath('router_test/test1')); + // It should not matter how many leading slashes are used. $url = $request->getUriForPath('/////////////////////////////////////////////////router_test/test1'); $this->drupalGet($url); $this->assertEqual(1, $this->redirectCount, $url . " redirected to " . $this->url);