Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 675bcab

Browse filesBrowse files
committed
[FrameworkBundle] Fixed configuration of php_errors.log
1 parent a726f05 commit 675bcab
Copy full SHA for 675bcab

File tree

4 files changed

+20
-13
lines changed
Filter options

4 files changed

+20
-13
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
+5-4Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -889,13 +889,14 @@ private function addPhpErrorsSection(ArrayNodeDefinition $rootNode)
889889
->addDefaultsIfNotSet()
890890
->children()
891891
->scalarNode('log')
892-
->info('Use the app logger instead of the PHP logger for logging PHP errors.')
892+
->info('Use the application logger instead of the PHP logger for logging PHP errors.')
893+
->example('"true" to use the default configuration: log all errors. "false" to disable. An integer bit field of E_* constants.')
893894
->defaultValue($this->debug)
894895
->treatNullLike($this->debug)
895896
->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()
897+
->ifTrue(function ($v) { return !(\is_int($v) || \is_bool($v)); })
898+
->thenInvalid('The "php_errors.log" parameter should be either an integer or a boolean.')
899+
->end()
899900
->end()
900901
->booleanNode('throw')
901902
->info('Throw PHP errors as \ErrorException instances.')

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

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -655,14 +655,14 @@ private function registerDebugConfiguration(array $config, ContainerBuilder $con
655655

656656
$definition = $container->findDefinition('debug.debug_handlers_listener');
657657

658-
if (!$config['log']) {
658+
if (false !== $config['log']) {
659+
if ($config['log'] !== true && $config['log'] !== 0) {
660+
$definition->replaceArgument(2, true === $config['log'] ? null : $config['log']);
661+
}
662+
} else {
659663
$definition->replaceArgument(1, null);
660664
}
661665

662-
if (\is_int($config['log']) && $config['log']) {
663-
$definition->replaceArgument(3, $config['log']);
664-
}
665-
666666
if (!$config['throw']) {
667667
$container->setParameter('debug.error_handler.throw_at', 0);
668668
}

‎src/Symfony/Bundle/FrameworkBundle/Resources/config/debug_prod.xml

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Resources/config/debug_prod.xml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<tag name="monolog.logger" channel="php" />
1717
<argument>null</argument><!-- Exception handler -->
1818
<argument type="service" id="logger" on-invalid="null" />
19-
<argument>-1</argument><!-- Log levels map for enabled error levels -->
19+
<argument>null</argument><!-- Log levels map for enabled error levels -->
2020
<argument>%debug.error_handler.throw_at%</argument>
2121
<argument>true</argument>
2222
<argument type="service" id="debug.file_link_formatter"></argument>

‎src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
+9-3Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -340,23 +340,29 @@ public function testEnabledPhpErrorsConfig()
340340
{
341341
$container = $this->createContainerFromFile('php_errors_enabled');
342342

343-
$this->assertEquals(new Reference('logger', ContainerInterface::NULL_ON_INVALID_REFERENCE), $container->getDefinition('debug.debug_handlers_listener')->getArgument(1));
343+
$definition = $container->getDefinition('debug.debug_handlers_listener');
344+
$this->assertEquals(new Reference('logger', ContainerInterface::NULL_ON_INVALID_REFERENCE), $definition->getArgument(1));
345+
$this->assertNull($definition->getArgument(2));
344346
$this->assertSame(-1, $container->getParameter('debug.error_handler.throw_at'));
345347
}
346348

347349
public function testDisabledPhpErrorsConfig()
348350
{
349351
$container = $this->createContainerFromFile('php_errors_disabled');
350352

351-
$this->assertNull($container->getDefinition('debug.debug_handlers_listener')->getArgument(1));
353+
$definition = $container->getDefinition('debug.debug_handlers_listener');
354+
$this->assertNull($definition->getArgument(1));
355+
$this->assertNull($definition->getArgument(2));
352356
$this->assertSame(0, $container->getParameter('debug.error_handler.throw_at'));
353357
}
354358

355359
public function testPhpErrorsWithLogLevel()
356360
{
357361
$container = $this->createContainerFromFile('php_errors_log_level');
358362

359-
$this->assertEquals(8, $container->getDefinition('debug.debug_handlers_listener')->getArgument(3));
363+
$definition = $container->getDefinition('debug.debug_handlers_listener');
364+
$this->assertEquals(new Reference('logger', ContainerInterface::NULL_ON_INVALID_REFERENCE), $definition->getArgument(1));
365+
$this->assertSame(8, $definition->getArgument(2));
360366
}
361367

362368
public function testRouter()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.