From 664f821895a24e30e82fcdf98ad4cf4784d72d0d Mon Sep 17 00:00:00 2001 From: Amrouche Hamza Date: Tue, 6 Mar 2018 13:55:14 +0100 Subject: [PATCH] [FrameworkBundle] framework.php_errors.log now accept a log level --- .../FrameworkBundle/DependencyInjection/Configuration.php | 6 +++++- .../DependencyInjection/FrameworkExtension.php | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php index 4eea195b99d2..030f2e7e4b3e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php @@ -833,10 +833,14 @@ private function addPhpErrorsSection(ArrayNodeDefinition $rootNode) ->info('PHP errors handling configuration') ->addDefaultsIfNotSet() ->children() - ->booleanNode('log') + ->scalarNode('log') ->info('Use the app logger instead of the PHP logger for logging PHP errors.') ->defaultValue($this->debug) ->treatNullLike($this->debug) + ->validate() + ->ifTrue(function ($v) { return !(\is_int($v) || \is_bool($v)); }) + ->thenInvalid('The "php_errors.log" parameter should be either an integer or a boolean.') + ->end() ->end() ->booleanNode('throw') ->info('Throw PHP errors as \ErrorException instances.') diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index 8fbc4c276100..480e3610e5d1 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -605,6 +605,10 @@ private function registerDebugConfiguration(array $config, ContainerBuilder $con $definition->replaceArgument(1, null); } + if (\is_int($config['log']) && $config['log']) { + $definition->replaceArgument(4, $config['log']); + } + if (!$config['throw']) { $container->setParameter('debug.error_handler.throw_at', 0); }