8000 feature #26504 [FrameworkBundle] framework.php_errors.log now accept … · symfony/symfony@44a6f60 · GitHub
[go: up one dir, main page]

Skip to content

Commit 44a6f60

Browse files
committed
feature #26504 [FrameworkBundle] framework.php_errors.log now accept a log level (Simperfit)
This PR was merged into the 4.1-dev branch. Discussion ---------- [FrameworkBundle] framework.php_errors.log now accept a log level | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes <!-- don't forget to update src/**/CHANGELOG.md files --> | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | no <!-- don't forget to update UPGRADE-*.md files --> | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | #26267 <!-- #-prefixed issue number(s), if any --> | License | MIT | Doc PR | todo <!-- required for new features --> We are testing that `framework.php_errors.log` is either a bool or an int (set the value of the log level you want). This fixes #26267, so it gives a way to not log some level on production. Commits ------- 664f821 [FrameworkBundle] framework.php_errors.log now accept a log level
2 parents 2e47edc + 664f821 commit 44a6f60

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -888,10 +888,14 @@ private function addPhpErrorsSection(ArrayNodeDefinition $rootNode)
888888
->info('PHP errors handling configuration')
889889
->addDefaultsIfNotSet()
890890
->children()
891-
->booleanNode('log')
891+
->scalarNode('log')
892892
->info('Use the app logger instead of the PHP logger for logging PHP errors.')
893893
->defaultValue($this->debug)
894894
->treatNullLike($this->debug)
895+
->validate()
896+
->ifTrue(function ($v) { return !(\is_int($v) || \is_bool($v)); })
897+
->thenInvalid('The "php_errors.log" parameter should be either an integer or a boolean.')
898+
->end()
895899
->end()
896900
->booleanNode('throw')
897901
->info('Throw PHP errors as \ErrorException instances.')

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,10 @@ private function registerDebugConfiguration(array $config, ContainerBuilder $con
655655
$definition->replaceArgument(1, null);
656656
}
657657

658+
if (\is_int($config['log']) && $config['log']) {
659+
$definition->replaceArgument(4, $config['log']);
660+
}
661+
658662
if (!$config['throw']) {
659663
$container->setParameter('debug.error_handler.throw_at', 0);
660664
}

0 commit comments

Comments
 (0)
0