Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Form] ArrayChoiceList can now deal with a null in choices#17502

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
issei-m wants to merge1 commit intosymfony:masterfromissei-m:fix-choice-bug

Conversation

@issei-m
Copy link
Contributor

QA
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets-
LicenseMIT
Doc PR-

Documentation says, since 2.7, choice value is treated as corresponding item value (ifchoices_as_values option is true). Null as well.

$builder->add('attending','choice',array('choices' =>array('yes' =>true,'no' =>false,'maybe' =>null,    ),'choices_as_values' =>true,));

But actually null doesn't work as expected sinceArrayChoiceList::getChoicesForValues() usesisset to check whether given value exists in its choices.

It should usearray_key_exists instead to do so here.

@issei-m
Copy link
ContributorAuthor

Sorry, I mistook target branch. So I re-create a new one.

fabpot added a commit that referenced this pull requestJan 27, 2016
… (issei-m)This PR was merged into the 2.7 branch.Discussion----------[Form] ArrayChoiceList can now deal with a null in choicesre-create for mistaken#17502---| Q             | A| ------------- | ---| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | -| License       | MIT| Doc PR        | -Documentation says, since 2.7, choice value is treated as corresponding item value (if `choices_as_values` option is true). Null as well.```php$builder->add('attending', 'choice', array(    'choices' => array(        'yes' => true,        'no' => false,        'maybe' => null,    ),    'choices_as_values' => true,));```But actually null doesn't work as expected since `ArrayChoiceList::getChoicesForValues()` uses `isset` to check whether given value exists in its choices.It should use `array_key_exists` instead to do so here.Commits-------68292bb [Form] ArrayChoiceList can now deal with a null in choices
@issei-missei-m deleted the fix-choice-bug branchJanuary 27, 2016 09:50
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@issei-m@xabbuh@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp