Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 96ed5b8

Browse files
committed
Escape synopsis output
1 parent 53d9b10 commit 96ed5b8

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/Symfony/Component/Console/Application.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,7 @@ public function renderThrowable(\Throwable $e, OutputInterface $output): void
833833
private function finishRenderThrowableOrException(OutputInterface $output): void
834834
{
835835
if (null !== $this->runningCommand) {
836-
$output->writeln(sprintf('<info>%s</info>', sprintf($this->runningCommand->getSynopsis(), $this->getName())), OutputInterface::VERBOSITY_QUIET);
836+
$output->writeln(sprintf('<info>%s</info>', OutputFormatter::escape(sprintf($this->runningCommand->getSynopsis(), $this->getName()))), OutputInterface::VERBOSITY_QUIET);
837837
$output->writeln('', OutputInterface::VERBOSITY_QUIET);
838838
}
839839
}

src/Symfony/Component/Console/Tests/Command/CommandTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,8 @@ public function testGetSynopsis()
192192
$command = new \TestCommand();
193193
$command->addOption('foo');
194194
$command->addArgument('bar');
195-
$this->assertEquals('namespace:name [--foo] [--] [<bar>]', $command->getSynopsis(), '->getSynopsis() returns the synopsis');
195+
$command->addArgument('info');
196+
$this->assertEquals('namespace:name [--foo] [--] [<bar> [<info>]]', $command->getSynopsis(), '->getSynopsis() returns the synopsis');
196197
}
197198

198199
public function testAddGetUsages()

0 commit comments

Comments
 (0)