WIP #25825: Add a failing test to demonstrate bug introduced in #24987. #25852
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds some failing tests to demonstrate the problem introduced by the above-referenced PR.
The main issue introduced is demonstrated by test
[B]
.hasParameterOption('-s')
returns the wrong result because it confuses the characters in the value of the-e
flag for additional options.Proposed resolution:
Back out #24987
Impact:
Symfony Console will once again have the limitation that one cannot use
cli.php -fh
to set the-f
flag AND get help via the-h
flag, becausehasParameterOption
/getParameterOption
only work with short parameters that appear by themselves (e.g.cli.php -f -h
). This limitation is necessary becausehasParameterOption()
has no access to the input definition.In the tests below, backing out #24987 would have the following effect:
[A]
: Control test:getOptions()
/getOption()
will continue to work as always.[B]
: Fixed[C]
and[D]
: Will fail. Fixed by [Console] Fix global console flag when used in chain #24987, but introduces a worse problem[E]
,[F]
and[G]
: Not supported.Remaining work:
The function
getParameterOption
still does not work correctly for short options with values. This bug was pre-existing, prior to #24987, and was not affected by that PR. See the comment on failing test[I]
.