Skip to content

Commit

Permalink
bug #25308 [FrameworkBundle] Fix a bug where a color tag will be show…
Browse files Browse the repository at this point in the history
…n 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
-------

890edf7 [FrameworkBundle] Fix a bug where a color tag will be shown when passing an antislash
  • Loading branch information
fabpot committed Dec 4, 2017
2 parents 11105f3 + 890edf7 commit b646de8
Showing 1 changed file with 3 additions and 1 deletion.
Expand Up @@ -11,6 +11,7 @@

namespace Symfony\Bundle\FrameworkBundle\Console\Descriptor;

use Symfony\Component\Console\Formatter\OutputFormatter;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\DependencyInjection\Alias;
Expand Down Expand Up @@ -226,7 +227,8 @@ protected function describeContainerServices(ContainerBuilder $builder, array $o
$rawOutput = isset($options['raw_text']) && $options['raw_text'];
foreach ($this->sortServiceIds($serviceIds) as $serviceId) {
$definition = $this->resolveServiceDefinition($builder, $serviceId);
$styledServiceId = $rawOutput ? $serviceId : sprintf('<fg=cyan>%s</fg=cyan>', $serviceId);

$styledServiceId = $rawOutput ? $serviceId : sprintf('<fg=cyan>%s</fg=cyan>', OutputFormatter::escape($serviceId));
if ($definition instanceof Definition) {
if ($showTag) {
foreach ($definition->getTag($showTag) as $key => $tag) {
Expand Down

0 comments on commit b646de8

Please sign in to comment.