From 44343b84fe843213137d0144e6dc7289ee92f38b Mon Sep 17 00:00:00 2001 From: Romain Gautier Date: Sat, 4 Oct 2014 09:30:21 +0200 Subject: [PATCH] fixed excluded_ajax_paths regexp fixed tests fixed regexp for php and js --- .../DependencyInjection/Configuration.php | 2 +- .../EventListener/WebDebugToolbarListener.php | 2 +- .../Tests/DependencyInjection/ConfigurationTest.php | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Symfony/Bundle/WebProfilerBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/WebProfilerBundle/DependencyInjection/Configuration.php index a95da11bcc918..e7ed2d0f347c3 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/WebProfilerBundle/DependencyInjection/Configuration.php @@ -45,7 +45,7 @@ public function getConfigTreeBuilder() ->end() ->end() ->booleanNode('intercept_redirects')->defaultFalse()->end() - ->scalarNode('excluded_ajax_paths')->defaultValue('^/bundles|^/_wdt')->end() + ->scalarNode('excluded_ajax_paths')->defaultValue('^/(app(_[\\w]+)?\\.php/)?(bundles|_wdt)')->end() ->end() ; diff --git a/src/Symfony/Bundle/WebProfilerBundle/EventListener/WebDebugToolbarListener.php b/src/Symfony/Bundle/WebProfilerBundle/EventListener/WebDebugToolbarListener.php index 73555ff234b90..93a466629e92c 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/EventListener/WebDebugToolbarListener.php +++ b/src/Symfony/Bundle/WebProfilerBundle/EventListener/WebDebugToolbarListener.php @@ -115,7 +115,7 @@ protected function injectToolbar(Response $response) '@WebProfiler/Profiler/toolbar_js.html.twig', array( 'position' => $this->position, - 'excluded_ajax_paths' => $this->excludedAjaxPaths, + 'excluded_ajax_paths' => addslashes($this->excludedAjaxPaths), 'token' => $response->headers->get('X-Debug-Token'), ) ))."\n"; diff --git a/src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/ConfigurationTest.php b/src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/ConfigurationTest.php index 26fdc2e1941f4..3192c75d33f42 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/ConfigurationTest.php +++ b/src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/ConfigurationTest.php @@ -31,11 +31,11 @@ public function testConfigTree($options, $results) public function getDebugModes() { return array( - array(array(), array('intercept_redirects' => false, 'toolbar' => false, 'position' => 'bottom', 'excluded_ajax_paths' => '^/bundles|^/_wdt')), - array(array('intercept_redirects' => true), array('intercept_redirects' => true, 'toolbar' => false, 'position' => 'bottom', 'excluded_ajax_paths' => '^/bundles|^/_wdt')), - array(array('intercept_redirects' => false), array('intercept_redirects' => false, 'toolbar' => false, 'position' => 'bottom', 'excluded_ajax_paths' => '^/bundles|^/_wdt')), - array(array('toolbar' => true), array('intercept_redirects' => false, 'toolbar' => true, 'position' => 'bottom', 'excluded_ajax_paths' => '^/bundles|^/_wdt')), - array(array('position' => 'top'), array('intercept_redirects' => false, 'toolbar' => false, 'position' => 'top', 'excluded_ajax_paths' => '^/bundles|^/_wdt')), + array(array(), array('intercept_redirects' => false, 'toolbar' => false, 'position' => 'bottom', 'excluded_ajax_paths' => '^/(app(_[\\w]+)?\\.php/)?(bundles|_wdt)')), + array(array('intercept_redirects' => true), array('intercept_redirects' => true, 'toolbar' => false, 'position' => 'bottom', 'excluded_ajax_paths' => '^/(app(_[\\w]+)?\\.php/)?(bundles|_wdt)')), + array(array('intercept_redirects' => false), array('intercept_redirects' => false, 'toolbar' => false, 'position' => 'bottom', 'excluded_ajax_paths' => '^/(app(_[\\w]+)?\\.php/)?(bundles|_wdt)')), + array(array('toolbar' => true), array('intercept_redirects' => false, 'toolbar' => true, 'position' => 'bottom', 'excluded_ajax_paths' => '^/(app(_[\\w]+)?\\.php/)?(bundles|_wdt)')), + array(array('position' => 'top'), array('intercept_redirects' => false, 'toolbar' => false, 'position' => 'top', 'excluded_ajax_paths' => '^/(app(_[\\w]+)?\\.php/)?(bundles|_wdt)')), array(array('excluded_ajax_paths' => 'test'), array('intercept_redirects' => false, 'toolbar' => false, 'position' => 'bottom', 'excluded_ajax_paths' => 'test')), ); }