From f9686b7af937aa699fa6c1f09334de483e30420f Mon Sep 17 00:00:00 2001 From: Larry Garfield Date: Sun, 11 Mar 2012 23:47:39 -0500 Subject: [PATCH] Add BC shiv to keep old-style Dirty URLs working. This should be a temporary fix only, and be removed later. --- core/lib/Drupal/Core/EventSubscriber/PathSubscriber.php | 7 +++++++ core/lib/Drupal/Core/UrlMatcher.php | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/core/lib/Drupal/Core/EventSubscriber/PathSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/PathSubscriber.php index e5722f77d60..94bdbc4f41e 100644 --- a/core/lib/Drupal/Core/EventSubscriber/PathSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/PathSubscriber.php @@ -31,10 +31,17 @@ class PathSubscriber implements EventSubscriberInterface { * The Event to process. */ public function onKernelRequestPathResolve(GetResponseEvent $event) { + $request = $event->getRequest(); $path = ltrim($request->getPathInfo(), '/'); + // Temporary BC shiv to support automated tests that still rely on old- + // style dirty URLs. + if (isset($_GET['q'])) { + $path = $_GET['q']; + } + if (empty($path)) { // @todo Temporary hack. Fix when configuration is injectable. $path = variable_get('site_frontpage', 'user'); diff --git a/core/lib/Drupal/Core/UrlMatcher.php b/core/lib/Drupal/Core/UrlMatcher.php index 77400e044d6..efa335f40d1 100644 --- a/core/lib/Drupal/Core/UrlMatcher.php +++ b/core/lib/Drupal/Core/UrlMatcher.php @@ -38,6 +38,15 @@ class UrlMatcher extends SymfonyUrlMatcher { // Symfony uses a prefixing / but we don't yet. $dpathinfo = ltrim($pathinfo, '/'); + // Temporary BC shiv to support automated tests that still rely on old- + // style dirty URLs. + // @todo Remove this once testbot knows how to deal with Symfony-style + // dirty URLs. + if (isset($_GET['q'])) { + $dpathinfo = $_GET['q']; + $pathinfo = '/' . $dpathinfo; + } + // Do our fancy frontpage logic. if (empty($dpathinfo)) { $dpathinfo = variable_get('site_frontpage', 'user');