Skip to content

Commit 4b5a8ac

Browse files
committed
Merge branch '7.2' into 7.3
* 7.2: (37 commits) fix dumped markup improve amqp connection issues [Serializer] [ObjectNormalizer] Filter int when using FILTER_BOOL Fix #53778 Issue 59387-2: make check with prefix more robust [PropertyInfo] Add missing test fix tests [Security][Validators] Review translations. [validator] Updated Dutch translation [FrameworkBundle] Fix wiring ConsoleProfilerListener [HttpKernel] Fix link to php doc [Lock] Make sure RedisStore will also support Valkey [Validator] Update sr_Cyrl 120:This value is not a valid slug. [Validator] Update sr_Latn 120:This value is not a valid slug. 6.4 Missing translations for Italian (it) #59419 tests(notifier): avoid failing SNS test with local AWS configuration Fix typo ratio comment chore: PropertyAccess - fix typo in DocBlock [Validator] Missing translations for Brazilian Portuguese (pt_BR) fix(dependency-injection): reset env vars with kernel.reset ...
2 parents f7d2f38 + 44271ca commit 4b5a8ac

File tree

5 files changed

+30
-13
lines changed

5 files changed

+30
-13
lines changed

Command/ContainerDebugCommand.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,9 @@ private function findProperServiceName(InputInterface $input, SymfonyStyle $io,
290290
return $matchingServices[0];
291291
}
292292

293-
return $io->choice('Select one of the following services to display its information', $matchingServices);
293+
natsort($matchingServices);
294+
295+
return $io->choice('Select one of the following services to display its information', array_values($matchingServices));
294296
}
295297

296298
private function findProperTagName(InputInterface $input, SymfonyStyle $io, ContainerBuilder $container, string $tagName): string
@@ -308,7 +310,9 @@ private function findProperTagName(InputInterface $input, SymfonyStyle $io, Cont
308310
return $matchingTags[0];
309311
}
310312

311-
return $io->choice('Select one of the following tags to display its information', $matchingTags);
313+
natsort($matchingTags);
314+
315+
return $io->choice('Select one of the following tags to display its information', array_values($matchingTags));
312316
}
313317

314318
private function findServiceIdsContaining(ContainerBuilder $container, string $name, bool $showHidden): array

EventListener/ConsoleProfilerListener.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ final class ConsoleProfilerListener implements EventSubscriberInterface
3838
/** @var \SplObjectStorage<Request, ?Request> */
3939
private \SplObjectStorage $parents;
4040

41+
private bool $disabled = false;
42+
4143
public function __construct(
4244
private readonly Profiler $profiler,
4345
private readonly RequestStack $requestStack,
@@ -66,7 +68,7 @@ public function initialize(ConsoleCommandEvent $event): void
6668

6769
$input = $event->getInput();
6870
if (!$input->hasOption('profile') || !$input->getOption('profile')) {
69-
$this->profiler->disable();
71+
$this->disabled = true;
7072

7173
return;
7274
}
@@ -92,7 +94,12 @@ public function catch(ConsoleErrorEvent $event): void
9294

9395
public function profile(ConsoleTerminateEvent $event): void
9496
{
95-
if (!$this->cliMode || !$this->profiler->isEnabled()) {
97+
$error = $this->error;
98+
$this->error = null;
99+
100+
if (!$this->cliMode || $this->disabled) {
101+
$this->disabled = false;
102+
96103
return;
97104
}
98105

@@ -114,8 +121,7 @@ public function profile(ConsoleTerminateEvent $event): void
114121
$request->command->exitCode = $event->getExitCode();
115122
$request->command->interruptedBySignal = $event->getInterruptingSignal();
116123

117-
$profile = $this->profiler->collect($request, $request->getResponse(), $this->error);
118-
$this->error = null;
124+
$profile = $this->profiler->collect($request, $request->getResponse(), $error);
119125
$this->profiles[$request] = $profile;
120126

121127
if ($this->parents[$request] = $this->requestStack->getParentRequest()) {

Resources/config/profiling.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,19 @@
4040

4141
->set('console_profiler_listener', ConsoleProfilerListener::class)
4242
->args([
43-
service('profiler'),
43+
service('.lazy_profiler'),
4444
service('.virtual_request_stack'),
4545
service('debug.stopwatch'),
4646
param('kernel.runtime_mode.cli'),
4747
service('router')->nullOnInvalid(),
4848
])
4949
->tag('kernel.event_subscriber')
5050

51+
->set('.lazy_profiler', Profiler::class)
52+
->factory('current')
53+
->args([[service('profiler')]])
54+
->lazy()
55+
5156
->set('.virtual_request_stack', VirtualRequestStack::class)
5257
->args([service('request_stack')])
5358
->public()

Resources/config/services.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ class_exists(WorkflowEvents::class) ? WorkflowEvents::ALIASES : []
100100
->alias(HttpKernelInterface::class, 'http_kernel')
101101

102102
->set('request_stack', RequestStack::class)
103+
->tag('kernel.reset', ['method' => 'resetRequestFormats', 'on_invalid' => 'ignore'])
103104
->public()
104105
->alias(RequestStack::class, 'request_stack')
105106

@@ -197,6 +198,7 @@ class_exists(WorkflowEvents::class) ? WorkflowEvents::ALIASES : []
197198
tagged_iterator('container.env_var_loader'),
198199
])
199200
->tag('container.env_var_processor')
201+
->tag('kernel.reset', ['method' => 'reset'])
200202

201203
->set('slugger', AsciiSlugger::class)
202204
->args([

Tests/Functional/ContainerDebugCommandTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,13 @@ public function testTagsPartialSearch()
140140
$tester->run(['command' => 'debug:container', '--tag' => 'kernel.'], ['decorated' => false]);
141141

142142
$this->assertStringContainsString('Select one of the following tags to display its information', $tester->getDisplay());
143-
$this->assertStringContainsString('[0] kernel.event_subscriber', $tester->getDisplay());
144-
$this->assertStringContainsString('[1] kernel.locale_aware', $tester->getDisplay());
145-
$this->assertStringContainsString('[2] kernel.cache_warmer', $tester->getDisplay());
143+
$this->assertStringContainsString('[0] kernel.cache_clearer', $tester->getDisplay());
144+
$this->assertStringContainsString('[1] kernel.cache_warmer', $tester->getDisplay());
145+
$this->assertStringContainsString('[2] kernel.event_subscriber', $tester->getDisplay());
146146
$this->assertStringContainsString('[3] kernel.fragment_renderer', $tester->getDisplay());
147-
$this->assertStringContainsString('[4] kernel.reset', $tester->getDisplay());
148-
$this->assertStringContainsString('[5] kernel.cache_clearer', $tester->getDisplay());
149-
$this->assertStringContainsString('Symfony Container Services Tagged with "kernel.event_subscriber" Tag', $tester->getDisplay());
147+
$this->assertStringContainsString('[4] kernel.locale_aware', $tester->getDisplay());
148+
$this->assertStringContainsString('[5] kernel.reset', $tester->getDisplay());
149+
$this->assertStringContainsString('Symfony Container Services Tagged with "kernel.cache_clearer" Tag', $tester->getDisplay());
150150
}
151151

152152
public function testDescribeEnvVars()

0 commit comments

Comments
 (0)