From 1b5442c13a013f9faf390e715b621eddd3cffdee Mon Sep 17 00:00:00 2001 From: Maxime STEINHAUSSER Date: Tue, 13 Dec 2016 11:36:36 +0100 Subject: [PATCH] [Console] MarkdownDescriptor: Strip tags in app headers --- .../Component/Console/Descriptor/MarkdownDescriptor.php | 4 +++- src/Symfony/Component/Console/Tests/Fixtures/application_2.md | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Console/Descriptor/MarkdownDescriptor.php b/src/Symfony/Component/Console/Descriptor/MarkdownDescriptor.php index b893d7ea0d9a..800629134d7e 100644 --- a/src/Symfony/Component/Console/Descriptor/MarkdownDescriptor.php +++ b/src/Symfony/Component/Console/Descriptor/MarkdownDescriptor.php @@ -13,6 +13,7 @@ use Symfony\Component\Console\Application; use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Helper\Helper; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputOption; @@ -122,8 +123,9 @@ protected function describeApplication(Application $application, array $options { $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null; $description = new ApplicationDescription($application, $describedNamespace); + $longVersion = strip_tags($application->getLongVersion()); - $this->write($application->getLongVersion()."\n".str_repeat('=', strlen($application->getLongVersion()))); + $this->write($longVersion."\n".str_repeat('=', Helper::strlen($longVersion))); foreach ($description->getNamespaces() as $namespace) { if (ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) { diff --git a/src/Symfony/Component/Console/Tests/Fixtures/application_2.md b/src/Symfony/Component/Console/Tests/Fixtures/application_2.md index 68c8b0be1c09..2dbfe1abfb1c 100644 --- a/src/Symfony/Component/Console/Tests/Fixtures/application_2.md +++ b/src/Symfony/Component/Console/Tests/Fixtures/application_2.md @@ -1,5 +1,5 @@ -My Symfony application v1.0 -======================================== +My Symfony application v1.0 +=========================== * `alias1` * `alias2`