Skip to content
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

[Command] New option shortcut collides with Symfony pre-3.x default option shortcuts, causing exception when running cache:resolve command #988

Closed
Danita opened this issue Sep 6, 2017 · 6 comments
Assignees
Labels
Attn: Critical This issue or PR is critical and should be rushed into a new release ASAP. Level: Bug 🐞 This item involves a legitimate regression (bug) to existing functionality. State: Confirmed This item has been confirmed by maintainers as legitimate.
Milestone

Comments

@Danita
Copy link

Danita commented Sep 6, 2017

Q A
Bug Report? yes
Feature Request? no
BC Break Report? yes
RFC? no
Imagine Bundle Version 1.9.0

Hi! We're getting the following error when running php app/console liip:imagine:cache:resolve -h on an application built with Symfony 2.8:

[Symfony\Component\Console\Exception\LogicException]  
An option with shortcut "s" already exists.

This is new to 1.9.0, it doesn't happen with 1.8.0. Seems to be related to this pull request https://github.com/liip/LiipImagineBundle/pull/967/files#diff-d758689e0e797fc5329e93e432a7e196R38

Thanks!

@robfrawley
Copy link
Collaborator

robfrawley commented Sep 7, 2017

@Danita Thanks for the report. Looks like older versions of the Symfony console had a --shell option (which was assigned the shortcut -s) and this is colliding with the recently introduced --as-script option (which was also assigned the shortcut -s). Symfony's use of --shell was removed in 3.0+ releases, and, aside from the automated testing of older Symfony releases (which do not bring in the default Symfony console options when building the test calls, and so would not throw an error as the conflicting options are not registered), I'd only "hand-tested" the changes on 3.0+ codebases.

In the future, it would likely be sensible to extend our tests to include additional functional ones with the entire Symfony environment loaded, so issues like this can be avoided. In the immediate, I'm working on a few minor "cleanup" tweaks to the latest console changes (to ensure the transition from the 1.x console commands to the 2.x ones is seamless), as well as the fix for the issue you've encountered, of course. With some luck, a patch release will be tagged in the mid- to late-morning (I'm in EDT, or -04:00 behind UTC, for reference :-)

If you need to run those commands in the interim, you can resolve the exception by removing the s option shortcut from line 38 of Command/ResolveCacheCommand.php and replacing it with null, making the line:

->addOption('as-script', null, InputOption::VALUE_NONE, // ...

Instead of broken, current implementation of:

->addOption('as-script', 's', InputOption::VALUE_NONE, // ...

@robfrawley robfrawley self-assigned this Sep 7, 2017
@robfrawley robfrawley added Level: Bug 🐞 This item involves a legitimate regression (bug) to existing functionality. Attn: Critical This issue or PR is critical and should be rushed into a new release ASAP. State: Confirmed This item has been confirmed by maintainers as legitimate. labels Sep 7, 2017
@robfrawley robfrawley added this to the 1.9.1 milestone Sep 7, 2017
@robfrawley robfrawley changed the title LogicException when running cache:resolve -h on Symfony 2.8 [Command] New option shortcut collides with Symfony pre-3.x default option shortcuts, causing exception when running cache:resolve command Sep 7, 2017
@robfrawley
Copy link
Collaborator

robfrawley commented Sep 8, 2017

Just as a quick update, resolution waiting on symfony/symfony#24105 (comment) as that PR broke our test suite (and user-facing code) for Symfony 2.7 and we never merge PRs with failing CI status.

@Danita
Copy link
Author

Danita commented Sep 8, 2017

If you need to run those commands in the interim, you can resolve the exception by removing the s option

For now we can use 1.8.0 until the issue is solved. Thanks for your quick response, it's very appreciated! 😄

@robfrawley
Copy link
Collaborator

robfrawley commented Sep 8, 2017

If you have a moment, test the changes that should resolve this issue by running the following in one of your projects to fetch my latest work and run the resolve/remove command:

rm -fr vendor/liip/imagine-bundle
git clone -b feature-bugfix-console-commands https://github.com/robfrawley/LiipImagineBundle.git vendor/liip/imagine-bundle
app/console liip:imagine:cache:resolve -h
app/console liip:imagine:cache:remove -h

@Danita
Copy link
Author

Danita commented Sep 8, 2017

Yes, it worked perfectly in our setup, thanks!

@robfrawley
Copy link
Collaborator

@Danita The 1.9.1 release has been tagged with the fix you tested. Enjoy! And thanks for the bug report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Attn: Critical This issue or PR is critical and should be rushed into a new release ASAP. Level: Bug 🐞 This item involves a legitimate regression (bug) to existing functionality. State: Confirmed This item has been confirmed by maintainers as legitimate.
Projects
None yet
Development

No branches or pull requests

2 participants