Skip to content

Commit 9a62c99

Browse files
Merge branch '6.4' into 7.0
* 6.4: [FrameworkBundle] Add TemplateController to the list of allowed controllers for fragments [Cache][Lock] Fix PDO store not creating table + add tests Closes #51936-Added Missing translations for Czech (cs) in validators.cs.xlf file Added missing translations in turkish and updated validators.tr.xlf [Serializer] Fix denormalizing date intervals having both weeks and days [Validator] updated Turkish translation [Serializer] Remove wrong final tags [Serializer] Fix denormalize constructor arguments Add some more non-countable English nouns Add hint that changing input arguments has no effect register the virtual request stack together with common profiling services Don't lose checkpoint state when lock is acquired from another [DomCrawler] Revert "bug #52579 UriResolver support path with colons" [VarExporter] Fix handling mangled property names returned by __sleep() Update Github template for 7.1 Fix memory limit in PhpSubprocess unit test
2 parents 0cf7153 + c9e4544 commit 9a62c99

File tree

6 files changed

+49
-6
lines changed

6 files changed

+49
-6
lines changed

Console/Application.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,12 @@ protected function doRunCommand(Command $command, InputInterface $input, OutputI
107107
}
108108

109109
(new SymfonyStyle($input, $output))->warning('The "--profile" option needs the Stopwatch component. Try running "composer require symfony/stopwatch".');
110+
} elseif (!$container->has('.virtual_request_stack')) {
111+
if ($output instanceof ConsoleOutputInterface) {
112+
$output = $output->getErrorOutput();
113+
}
114+
115+
(new SymfonyStyle($input, $output))->warning('The "--profile" option needs the profiler integration. Try enabling the "framework.profiler" option.');
110116
} else {
111117
$command = new TraceableCommand($command, $container->get('debug.stopwatch'));
112118

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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;
13+
14+
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
15+
use Symfony\Component\DependencyInjection\ContainerBuilder;
16+
use Symfony\Component\DependencyInjection\Reference;
17+
18+
class VirtualRequestStackPass implements CompilerPassInterface
19+
{
20+
public function process(ContainerBuilder $container): void
21+
{
22+
if ($container->has('.virtual_request_stack')) {
23+
return;
24+
}
25+
26+
if ($container->hasDefinition('debug.event_dispatcher')) {
27+
$container->getDefinition('debug.event_dispatcher')->replaceArgument(3, new Reference('request_stack', ContainerBuilder::NULL_ON_INVALID_REFERENCE));
28+
}
29+
30+
if ($container->hasDefinition('debug.log_processor')) {
31+
$container->getDefinition('debug.log_processor')->replaceArgument(0, new Reference('request_stack'));
32+
}
33+
}
34+
}

FrameworkBundle.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\TestServiceContainerRealRefPass;
2121
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\TestServiceContainerWeakRefPass;
2222
use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\UnusedTagsPass;
23+
use Symfony\Bundle\FrameworkBundle\DependencyInjection\VirtualRequestStackPass;
2324
use Symfony\Component\Cache\Adapter\ApcuAdapter;
2425
use Symfony\Component\Cache\Adapter\ArrayAdapter;
2526
use Symfony\Component\Cache\Adapter\ChainAdapter;
@@ -171,6 +172,7 @@ public function build(ContainerBuilder $container): void
171172
$container->addCompilerPass(new RemoveUnusedSessionMarshallingHandlerPass());
172173
// must be registered after MonologBundle's LoggerChannelPass
173174
$container->addCompilerPass(new ErrorLoggerCompilerPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, -32);
175+
$container->addCompilerPass(new VirtualRequestStackPass());
174176

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

Resources/config/debug.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
use Symfony\Component\HttpKernel\Controller\TraceableArgumentResolver;
1616
use Symfony\Component\HttpKernel\Controller\TraceableControllerResolver;
1717
use Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher;
18-
use Symfony\Component\HttpKernel\Debug\VirtualRequestStack;
1918

2019
return static function (ContainerConfigurator $container) {
2120
$container->services()
@@ -47,9 +46,5 @@
4746
->set('argument_resolver.not_tagged_controller', NotTaggedControllerValueResolver::class)
4847
->args([abstract_arg('Controller argument, set in FrameworkExtension')])
4948
->tag('controller.argument_value_resolver', ['priority' => -200])
50-
51-
->set('.virtual_request_stack', VirtualRequestStack::class)
52-
->args([service('request_stack')])
53-
->public()
5449
;
5550
};

Resources/config/profiling.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
1313

1414
use Symfony\Bundle\FrameworkBundle\EventListener\ConsoleProfilerListener;
15+
use Symfony\Component\HttpKernel\Debug\VirtualRequestStack;
1516
use Symfony\Component\HttpKernel\EventListener\ProfilerListener;
1617
use Symfony\Component\HttpKernel\Profiler\FileProfilerStorage;
1718
use Symfony\Component\HttpKernel\Profiler\Profiler;
@@ -45,5 +46,9 @@
4546
service('router'),
4647
])
4748
->tag('kernel.event_subscriber')
49+
50+
->set('.virtual_request_stack', VirtualRequestStack::class)
51+
->args([service('request_stack')])
52+
->public()
4853
;
4954
};

Resources/config/web.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
1515
use Symfony\Bundle\FrameworkBundle\Controller\ControllerResolver;
16+
use Symfony\Bundle\FrameworkBundle\Controller\TemplateController;
1617
use Symfony\Component\HttpKernel\Controller\ArgumentResolver;
1718
use Symfony\Component\HttpKernel\Controller\ArgumentResolver\BackedEnumValueResolver;
1819
use Symfony\Component\HttpKernel\Controller\ArgumentResolver\DateTimeValueResolver;
@@ -41,7 +42,7 @@
4142
service('service_container'),
4243
service('logger')->ignoreOnInvalid(),
4344
])
44-
->call('allowControllers', [[AbstractController::class]])
45+
->call('allowControllers', [[AbstractController::class, TemplateController::class]])
4546
->tag('monolog.logger', ['channel' => 'request'])
4647

4748
->set('argument_metadata_factory', ArgumentMetadataFactory::class)

0 commit comments

Comments
 (0)