Skip to content

Commit 6d5928b

Browse files
committed
bug #25308 [FrameworkBundle] Fix a bug where a color tag will be shown when passing an antislash (Simperfit)
This PR was merged into the 3.3 branch. Discussion ---------- [FrameworkBundle] Fix a bug where a color tag will be shown when passing an antislash | Q | A | ------------- | --- | Branch? | 3.3 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #25193 | License | MIT | Doc PR | none You can see in the [reproducer](Simperfit/symfony-reproducer@e6509ff) when running `bin/console debug:container` that there an error in the ouput (like in the issue) when using a class with `\` in the service name. This PR fix this wrong output. (even if that feels more developer thingy when there are xml everywhere ;) Commits ------- 890edf7c38 [FrameworkBundle] Fix a bug where a color tag will be shown when passing an antislash
2 parents d1380de + 90b85b1 commit 6d5928b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Console/Descriptor/TextDescriptor.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\Console\Descriptor;
1313

14+
use Symfony\Component\Console\Formatter\OutputFormatter;
1415
use Symfony\Component\Console\Helper\Table;
1516
use Symfony\Component\Console\Style\SymfonyStyle;
1617
use Symfony\Component\DependencyInjection\Alias;
@@ -226,7 +227,8 @@ protected function describeContainerServices(ContainerBuilder $builder, array $o
226227
$rawOutput = isset($options['raw_text']) && $options['raw_text'];
227228
foreach ($this->sortServiceIds($serviceIds) as $serviceId) {
228229
$definition = $this->resolveServiceDefinition($builder, $serviceId);
229-
$styledServiceId = $rawOutput ? $serviceId : sprintf('<fg=cyan>%s</fg=cyan>', $serviceId);
230+
231+
$styledServiceId = $rawOutput ? $serviceId : sprintf('<fg=cyan>%s</fg=cyan>', OutputFormatter::escape($serviceId));
230232
if ($definition instanceof Definition) {
231233
if ($showTag) {
232234
foreach ($definition->getTag($showTag) as $key => $tag) {

0 commit comments

Comments
 (0)