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

Skip to content

Fix the list of supported shells for completions in a phar#50111

Merged
fabpot merged 1 commit into
symfony:5.4from
stof:supported_shells_phar
Apr 22, 2023
Merged

Fix the list of supported shells for completions in a phar#50111
fabpot merged 1 commit into
symfony:5.4from
stof:supported_shells_phar

Conversation

@stof
Copy link
Copy Markdown
Member

@stof stof commented Apr 21, 2023

Q A
Branch? 5.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets n/a
License MIT
Doc PR n/a

Using glob inside a phar does not work (it does not find anything). Using a DirectoryIterator on the other hand works with phars. This allows this command to compute the list of supported shells properly when used inside a phar.

Easy way to reproduce the bug: run composer completion unsupported (or more realistically composer completion in a zsh shell as zsh is not a supported shell in symfony/console 5.4) with composer 2.5.5 and see that you get this error with an empty list of supported shells:

Detected shell "unsupported", which is not supported by Symfony shell completion (supported shells: "").

Using glob inside a phar does not work (it does not find anything).
Using a DirectoryIterator on the other hand works with phars. This
allows this command to compute the list of supported shells properly
when used inside a phar.
@stof stof requested a review from chalasr as a code owner April 21, 2023 18:07
@carsonbot carsonbot added this to the 5.4 milestone Apr 21, 2023
@fabpot
Copy link
Copy Markdown
Member

fabpot commented Apr 22, 2023

Thank you @stof.

@fabpot fabpot merged commit 7589ff6 into symfony:5.4 Apr 22, 2023
This was referenced Apr 28, 2023
@stof stof deleted the supported_shells_phar branch May 11, 2023 13:58
@guvra
Copy link
Copy Markdown

guvra commented May 17, 2023

FYI this introduced a regression on our side because the folder "Resources" is now mandatory (which was not the case before), so our compiled phar file didn't work anymore because we only included php files in it.

Easily fixable on our side by forcing the phar compiler to include these completion files though.

@stof
Copy link
Copy Markdown
Member Author

stof commented May 17, 2023

Well, I would say that working with modified source code of the component is not really covered by our BC policy.
Also, the whole command would break if you don't include these completion files (executing the command will read those files to generate things).

@guvra
Copy link
Copy Markdown

guvra commented May 17, 2023

Well, I would say that working with modified source code of the component is not really covered by our BC policy.

Yes I understand that, it's why i said that it's easily fixable on our side 👍

Also, the whole command would break if you don't include these completion files (executing the command will read those files to generate things).

Actually, when the Resources folder does not exist, the new code logic breaks any command that uses the symfony/console package, not just the command "DumpCompletionCommand" where the code logic was changed.

It's because the logic is contained in the method configure, which is called for all commands defined in the application.

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.

4 participants