From cb5659afc01f684ec536ef727bc8c7905258a096 Mon Sep 17 00:00:00 2001 From: WouterJ Date: Mon, 24 Jun 2013 22:26:23 +0200 Subject: [PATCH] Support multiple IPs for matching --- src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md | 5 +++++ .../FrameworkBundle/DependencyInjection/Configuration.php | 6 +++++- .../DependencyInjection/FrameworkExtension.php | 6 +++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md b/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md index 0e9393ca29..95dcc7415d 100644 --- a/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md +++ b/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md @@ -1,6 +1,11 @@ CHANGELOG ========= +2.4.0 +----- + + * allowed multiple IP addresses in profiler matcher settings + 2.3.0 ----- diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php index 8a7391789c..32df4ba2ee 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php @@ -149,13 +149,17 @@ class Configuration implements ConfigurationInterface ->arrayNode('matcher') ->canBeUnset() ->performNoDeepMerging() + ->fixXmlConfig('ip') ->children() - ->scalarNode('ip')->end() ->scalarNode('path') ->info('use the urldecoded format') ->example('^/path to resource/') ->end() ->scalarNode('service')->end() + ->arrayNode('ips') + ->beforeNormalization()->ifString()->then(function($v) { return array($v); })->end() + ->prototype('scalar')->end() + ->end() ->end() ->end() ->end() diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index ded7ac4094..4466b260ff 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -241,7 +241,7 @@ class FrameworkExtension extends Extension if (isset($config['matcher'])) { if (isset($config['matcher']['service'])) { $container->setAlias('profiler.request_matcher', $config['matcher']['service']); - } elseif (isset($config['matcher']['ip']) || isset($config['matcher']['path'])) { + } elseif (isset($config['matcher']['ip']) || isset($config['matcher']['path']) || isset($config['matcher']['ips'])) { $definition = $container->register('profiler.request_matcher', 'Symfony\\Component\\HttpFoundation\\RequestMatcher'); $definition->setPublic(false); @@ -249,6 +249,10 @@ class FrameworkExtension extends Extension $definition->addMethodCall('matchIp', array($config['matcher']['ip'])); } + if (isset($config['matcher']['ips'])) { + $definition->addMethodCall('matchIps', array($config['matcher']['ips'])); + } + if (isset($config['matcher']['path'])) { $definition->addMethodCall('matchPath', array($config['matcher']['path'])); }