From 2a4e4661396cd22d7fcea98809ad99f43f94aab7 Mon Sep 17 00:00:00 2001 From: webchick Date: Sun, 11 Aug 2013 23:42:02 -0700 Subject: [PATCH] Issue #2026037 by Crell: Check for legacy controllers based on the legacy flag, not the callable type. --- .../Core/EventSubscriber/LegacyControllerSubscriber.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/lib/Drupal/Core/EventSubscriber/LegacyControllerSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/LegacyControllerSubscriber.php index 0abcaf1d318..dca2708e5c0 100644 --- a/core/lib/Drupal/Core/EventSubscriber/LegacyControllerSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/LegacyControllerSubscriber.php @@ -37,11 +37,11 @@ class LegacyControllerSubscriber implements EventSubscriberInterface { */ public function onKernelControllerLegacy(FilterControllerEvent $event) { $request = $event->getRequest(); - $router_item = $request->attributes->get('_drupal_menu_item'); - $controller = $event->getController(); - // This BC logic applies only to functions. Otherwise, skip it. - if (is_string($controller) && function_exists($controller)) { + // If we're dealing with a legacy route, wrap the controller in a closure + // so parameters still work. + if ($request->attributes->get('_legacy')) { + $router_item = $request->attributes->get('_drupal_menu_item'); $new_controller = function() use ($router_item) { return call_user_func_array($router_item['page_callback'], $router_item['page_arguments']); };