-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Closed
Description
Symfony version(s) affected: 5.1-dev
Description
If we pass single id to messenger:failed:remove command, this error happen:
In FailedMessagesRemoveCommand.php line 65:
count(): Parameter must be an array or an object that implements Countable
messenger:failed:remove [--force] [--show-messages] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command> <id>...
How to reproduce
$application = new Application($this->kernel);
$application->setAutoExit(false);
$output = new BufferedOutput();
$code = $application->run(new ArrayInput([
'command' => 'messenger:failed:remove',
'id' => $id,
'--force' => true,
]), $output);
dump($output->fetch());
Possible Solution
Cast id argument to array:
$ids = (array) $input->getArgument('id');
Additional context
This error happen with CommandTester also:
$command = new FailedMessagesRemoveCommand(
'failure_receiver',
$receiver
);
$tester = new CommandTester($command);
$tester->execute(['id' => 20, '--force' => true]);
But this error does not happen if I run command from command line:
tests/app/bin/console messenger:failed:remove 1 --force