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

Skip to content

[Console] % signs in command's description leads to error on bin/console list #46560

@ThomasLandauer

Description

@ThomasLandauer

Symfony version(s) affected

6.1.0

Description

Not a big deal, but I'm reporting it anyway:

When using the new #AsCommand() attribute, and the description contains a "parameter-like" substring (i.e. something between two % signs), then running php bin/console list results in:

[critical] Error thrown while running command "list". Message: "The parameter "a\" must be defined."
In App_KernelDevDebugContainer.php line 370:
The parameter "a\" must be defined.

How to reproduce

use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;

#[AsCommand(name: 'app:foo', description: '%a%')]
final class FooCommand extends Command
{
}

Possible Solution

Don't parse the description at all (i.e. output it as-is), or provide some escaping mechanism.

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions