Skip to content

Commit b7abd18

Browse files
Merge branch '6.3' into 6.4
* 6.3: Sync .github/expected-missing-return-types.diff [FrameworkBundle] Add void return-type to ErrorLoggerCompilerPass [DoctrineBridge] Fix cross-versions compat [HttpKernel] Handle nullable callback of StreamedResponse [Mailer] Capitalize sender header for Mailgun [FrameworkBundle] Configure `logger` as error logger if the Monolog Bundle is not registered DX: PHP CS Fixer - drop explicit nullable_type_declaration_for_default_null_value config, as it's part of ruleset anyway DX: PHP CS Fixer - drop explicit no_superfluous_phpdoc_tags config, as it's part of ruleset already Revert "Add keyword `dev` to leverage composer hint" [Validator] Add missing Ukrainian translations #51960 [Validator] Add missing translations for Indonesian (id) [Validator] Add missing translations for Vietnamese (VI) Add missing Validator translations - Croatian (hr) Run high-deps tests with ORM 3 and DBAL 4 [FrameworkBundle] Fix calling Kernel::warmUp() when running cache:warmup
2 parents f9ee22f + 87365f4 commit b7abd18

File tree

5 files changed

+52
-6
lines changed

5 files changed

+52
-6
lines changed

Command/CacheWarmupCommand.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use Symfony\Component\Console\Style\SymfonyStyle;
2020
use Symfony\Component\DependencyInjection\Dumper\Preloader;
2121
use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerAggregate;
22+
use Symfony\Component\HttpKernel\CacheWarmer\WarmableInterface;
2223

2324
/**
2425
* Warmup the cache.
@@ -65,8 +66,13 @@ protected function execute(InputInterface $input, OutputInterface $output): int
6566
if (!$input->getOption('no-optional-warmers')) {
6667
$this->cacheWarmer->enableOptionalWarmers();
6768
}
69+
$cacheDir = $kernel->getContainer()->getParameter('kernel.cache_dir');
6870

69-
$preload = $this->cacheWarmer->warmUp($cacheDir = $kernel->getContainer()->getParameter('kernel.cache_dir'));
71+
if ($kernel instanceof WarmableInterface) {
72+
$kernel->warmUp($cacheDir);
73+
}
74+
75+
$preload = $this->cacheWarmer->warmUp($cacheDir);
7076

7177
if ($preload && file_exists($preloadFile = $cacheDir.'/'.$kernel->getContainer()->getParameter('kernel.container_class').'.preload.php')) {
7278
Preloader::append($preloadFile, $preload);
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler;
13+
14+
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
15+
use Symfony\Component\DependencyInjection\ContainerBuilder;
16+
use Symfony\Component\DependencyInjection\Reference;
17+
18+
/**
19+
* @internal
20+
*/
21+
class ErrorLoggerCompilerPass implements CompilerPassInterface
22+
{
23+
public function process(ContainerBuilder $container): void
24+
{
25+
if (!$container->hasDefinition('debug.debug_handlers_listener')) {
26+
return;
27+
}
28+
29+
$definition = $container->getDefinition('debug.debug_handlers_listener');
30+
if ($container->hasDefinition('monolog.logger.php')) {
31+
$definition->replaceArgument(0, new Reference('monolog.logger.php'));
32+
}
33+
if ($container->hasDefinition('monolog.logger.deprecation')) {
34+
$definition->replaceArgument(5, new Reference('monolog.logger.deprecation'));
35+
}
36+
}
37+
}

FrameworkBundle.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\AssetsContextPass;
1818
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\ContainerBuilderDebugDumpPass;
1919
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\DataCollectorTranslatorPass;
20+
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\ErrorLoggerCompilerPass;
2021
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\LoggingTranslatorPass;
2122
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\ProfilerPass;
2223
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\RemoveUnusedSessionMarshallingHandlerPass;
@@ -180,6 +181,8 @@ public function build(ContainerBuilder $container)
180181
$container->addCompilerPass(new RegisterReverseContainerPass(true));
181182
$container->addCompilerPass(new RegisterReverseContainerPass(false), PassConfig::TYPE_AFTER_REMOVING);
182183
$container->addCompilerPass(new RemoveUnusedSessionMarshallingHandlerPass());
184+
// must be registered after MonologBundle's LoggerChannelPass
185+
$container->addCompilerPass(new ErrorLoggerCompilerPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, -32);
183186

184187
if ($container->getParameter('kernel.debug')) {
185188
$container->addCompilerPass(new AddDebugLogProcessorPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, 2);

Resources/config/debug_prod.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@
2222
->set('debug.error_handler_configurator', ErrorHandlerConfigurator::class)
2323
->public()
2424
->args([
25-
service('monolog.logger.php')->nullOnInvalid(),
25+
service('logger')->nullOnInvalid(),
2626
null, // Log levels map for enabled error levels
2727
param('debug.error_handler.throw_at'),
2828
param('kernel.debug'),
2929
param('kernel.debug'),
30-
service('monolog.logger.deprecation')->nullOnInvalid(),
30+
service('logger')->nullOnInvalid(),
3131
])
3232
->tag('monolog.logger', ['channel' => 'php'])
3333

Tests/DependencyInjection/FrameworkExtensionTestCase.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ public function testEnabledPhpErrorsConfig()
549549
$container = $this->createContainerFromFile('php_errors_enabled');
550550

551551
$definition = $container->getDefinition('debug.error_handler_configurator');
552-
$this->assertEquals(new Reference('monolog.logger.php', ContainerInterface::NULL_ON_INVALID_REFERENCE), $definition->getArgument(0));
552+
$this->assertEquals(new Reference('logger', ContainerInterface::NULL_ON_INVALID_REFERENCE), $definition->getArgument(0));
553553
$this->assertNull($definition->getArgument(1));
554554
$this->assertSame(-1, $container->getParameter('debug.error_handler.throw_at'));
555555
}
@@ -569,7 +569,7 @@ public function testPhpErrorsWithLogLevel()
569569
$container = $this->createContainerFromFile('php_errors_log_level');
570570

571571
$definition = $container->getDefinition('debug.error_handler_configurator');
572-
$this->assertEquals(new Reference('monolog.logger.php', ContainerInterface::NULL_ON_INVALID_REFERENCE), $definition->getArgument(0));
572+
$this->assertEquals(new Reference('logger', ContainerInterface::NULL_ON_INVALID_REFERENCE), $definition->getArgument(0));
573573
$this->assertSame(8, $definition->getArgument(1));
574574
}
575575

@@ -578,7 +578,7 @@ public function testPhpErrorsWithLogLevels()
578578
$container = $this->createContainerFromFile('php_errors_log_levels');
579579

580580
$definition = $container->getDefinition('debug.error_handler_configurator');
581-
$this->assertEquals(new Reference('monolog.logger.php', ContainerInterface::NULL_ON_INVALID_REFERENCE), $definition->getArgument(0));
581+
$this->assertEquals(new Reference('logger', ContainerInterface::NULL_ON_INVALID_REFERENCE), $definition->getArgument(0));
582582
$this->assertSame([
583583
\E_NOTICE => \Psr\Log\LogLevel::ERROR,
584584
\E_WARNING => \Psr\Log\LogLevel::ERROR,

0 commit comments

Comments
 (0)