-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
[Console] Misuse of ArgvInput
with arrays needs a better error handling
#53836
Labels
Comments
Maybe #54149 helps already? |
fabpot
added a commit
that referenced
this issue
Mar 9, 2024
…abus) This PR was merged into the 7.1 branch. Discussion ---------- [Console] Document argv arrays for static analysis | Q | A | ------------- | --- | Branch? | 7.1 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | Part of #53836 | License | MIT This PR adds PHPDoc blocks for static analyzers that should make mistakes like the ones described in #53836 more discoverable. Commits ------- a84f39a [Console] Document argv arrays for static analysis
symfony-splitter
pushed a commit
to symfony/console
that referenced
this issue
Jun 3, 2024
… with arrays (symfonyaml) This PR was squashed before being merged into the 7.2 branch. Discussion ---------- [Console] Better error handling when misuse of `ArgvInput` with arrays | Q | A | ------------- | --- | Branch? | 7.1 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | Fix #53836 | License | MIT ### Issue When we don't use `ArgvInput` correclty, and use array in $argv values, it returns different PHP fatal errors. See all details and how to reproduce it in the issue symfony/symfony#53836 ### Solution In this PR - Add some DX with an exception explaining the problem, to avoid PHP fatal errors - Add tests** _____ Note : Old PR #54147 was targeting 5.4, see [this comment](symfony/symfony#54147 (comment)) for more details Commits ------- 6f64cf4f80 [Console] Better error handling when misuse of `ArgvInput` with arrays
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Symfony version(s) affected
5.4
Description
Misuse of
ArgvInput
with array in $argv returns different PHP fatal errors, instead of some DX with a nice exception explaining the situation.The misuse :
Calling
bind()
method :Calling
hasParameterOption()
orgetParameterOption()
methods :How to reproduce
symfony/console
repotest.php
to throw the errorPossible Solution
Maybe we should prevent to pass array values in the
ArgvInput
constructor like :Additional Context
There is a kind of related issue with
ArrayInput
by @niklaswolf : #52580The text was updated successfully, but these errors were encountered: