Skip to content

[FrameworkBundle] Fail properly on unregistrable command #48547

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: 7.4
Choose a base branch
from

Conversation

simPod
Copy link
Contributor

@simPod simPod commented Dec 8, 2022

Q A
Branch? 6.3
Bug fix? no
New feature? yes
Deprecations? no
License MIT
Doc PR symfony/symfony-docs#...

When commands are not possible to be registered, the console should return non-zero status code and not fail silently

Real-case scenario: SncRedisBundle v4.4 broke the rest of my commands because its commands could not be registered snc/SncRedisBundle#683.
I run bin/console in CI to see if something is broken.
But even though in CI there were tonz of warnings, it returned Success at the end and the broken application slipped into the production and broke it.

 [WARNING] Some commands could not be registered:


In ReplicationOption.php line 52:

  Values evaluating to FALSE are not accepted for `replication`


In ReplicationOption.php line 52:

  Values evaluating to FALSE are not accepted for `replication`


In ReplicationOption.php line 52:

  Values evaluating to FALSE are not accepted for `replication`

@carsonbot
Copy link

Hey!

To help keep things organized, we don't allow "Draft" pull requests. Could you please click the "ready for review" button or close this PR and open a new one when you are done?

Note that a pull request does not have to be "perfect" or "ready for merge" when you first open it. We just want it to be ready for a first review.

Cheers!

Carsonbot

@simPod simPod marked this pull request as ready for review December 8, 2022 13:45
@carsonbot carsonbot added this to the 6.3 milestone Dec 8, 2022
@carsonbot carsonbot changed the title [FrameworkBundle]: Fail properly on unregistrable command [FrameworkBundle] : Fail properly on unregistrable command Dec 8, 2022
@OskarStark OskarStark changed the title [FrameworkBundle] : Fail properly on unregistrable command [FrameworkBundle] Fail properly on unregistrable command Dec 8, 2022
$this->renderRegistrationErrors($input, $output);
}

$this->setDispatcher($this->kernel->getContainer()->get('event_dispatcher'));

return parent::doRun($input, $output);
return max($statusCode, parent::doRun($input, $output));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should not change the status code of all existing commands.
Instead, I propose that we change the status code of the "list" command only.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, but why? Is there any reason any command should succeed when there are registration errors?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question the other way around, I'm against breaking the whole console when only one command is down.

@nicolas-grekas nicolas-grekas modified the milestones: 6.3, 6.4 May 23, 2023
@nicolas-grekas nicolas-grekas modified the milestones: 6.4, 7.1 Nov 15, 2023
@xabbuh xabbuh modified the milestones: 7.1, 7.2 May 15, 2024
@fabpot fabpot modified the milestones: 7.2, 7.3 Nov 20, 2024
@fabpot fabpot modified the milestones: 7.3, 7.4 May 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants