8000 [3.0.3] [console] Notice on QuestionHelper · Issue #18001 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[3.0.3] [console] Notice on QuestionHelper #18001

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

Closed
shopblocks opened this issue Mar 3, 2016 · 3 comments
Closed

[3.0.3] [console] Notice on QuestionHelper #18001

shopblocks opened this issue Mar 3, 2016 · 3 comments

Comments

@shopblocks
Copy link

If I define my code as follows:

$question = new ChoiceQuestion('Is this server for Production or Staging', [
    1 => 'production',
    2 => 'staging',
], '1');

$choice = $this->question->ask($input, $output, $question);

If i run this question and then press the up arrow, I get undefined offset '0' error.

I want to be able to number these options myself. If i dont number, then everything is fine, but if i do number then this is the result we get.

Full error: PHP Notice: Undefined offset: 0 in /.../console/vendor/symfony/console/Helper/QuestionHelper.php on line 302

@hhamon
Copy link
Contributor
hhamon commented Mar 9, 2016

I confirm this notice error message when trying your code on Symfony 3.0.3.

fabpot added a commit that referenced this issue Mar 9, 2016
… non-sequentially indexed choices (jakzal)

This PR was merged into the 2.7 branch.

Discussion
----------

[Console] Fix an autocompletion question helper issue with non-sequentially indexed choices

| Q             | A
| ------------- | ---
| Branch        | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #18001
| License       | MIT
| Doc PR        | -

Commits
-------

9c3247c [Console] Fix an autocompletion question helper issue with non-sequentially indexed choices
@fabpot fabpot closed this as completed Mar 9, 2016
@shopblocks
Copy link
Author

I see the merge references 2.7, does this automatically get ported to 3.0 too?

@jakzal
Copy link
Contributor
jakzal commented Mar 9, 2016

@shopblocks not automatically, but we merge older branches to the newer ones regularly, so the fix will eventually get to 3.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants
0