Skip to content

Commit 6454a70

Browse files
committed
Merge branch '6.4' into 7.1
* 6.4: (29 commits) Fix #53778 [PropertyInfo] Add missing test fix tests [Security][Validators] Review translations. [validator] Updated Dutch translation [FrameworkBundle] Fix wiring ConsoleProfilerListener [HttpKernel] Fix link to php doc [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 [Validator] Missing translations for Brazilian Portuguese (pt_BR) [Translation][Validator] Review Russian translation (114 - 120) Review validator-related persian translation with id 120 [Scheduler] Clarify description of exclusion time [HttpFoundation][FrameworkBundle] Reset Request's formats using the service resetter [Mailer] Fix SMTP stream EOF handling on Windows by using feof() [Translations] Make sure PL translations validators.pl.xlf follow the same style [Validator] Checked Turkish validators translations and confirmed [VarDumper] Fix blank strings display ...
2 parents f2c4d74 + 45e3acf commit 6454a70

File tree

5 files changed

+29
-13
lines changed

5 files changed

+29
-13
lines changed

Command/ContainerDebugCommand.php

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

287-
return $io->choice('Select one of the following services to display its information', $matchingServices);
287+
natsort($matchingServices);
288+
289+
return $io->choice('Select one of the following services to display its information', array_values($matchingServices));
288290
}
289291

290292
private function findProperTagName(InputInterface $input, SymfonyStyle $io, ContainerBuilder $container, string $tagName): string
@@ -302,7 +304,9 @@ private function findProperTagName(InputInterface $input, SymfonyStyle $io, Cont
302304
return $matchingTags[0];
303305
}
304306

305-
return $io->choice('Select one of the following tags to display its information', $matchingTags);
307+
natsort($matchingTags);
308+
309+
return $io->choice('Select one of the following tags to display its information', array_values($matchingTags));
306310
}
307311

308312
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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ class_exists(WorkflowEvents::class) ? WorkflowEvents::ALIASES : []
9999
->alias(HttpKernelInterface::class, 'http_kernel')
100100

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

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)