Skip to content

[Form][2.0] wrong label when its value is "0" #6862

Closed
Cethy opened this Issue Jan 24, 2013 · 1 comment

3 participants

@Cethy
Cethy commented Jan 24, 2013

I have a choice type with a choice which is labelled "0", when I display it, I have 1 (which is the position of the choice in the choiceList) instead of 0 in my label.

The problem comes from FieldType::55 :
$builder->setAttribute('label', $options['label'] ?: $this->humanize($builder->getName()));
should be
$builder->setAttribute('label', strlen($options['label']) ? $options['label'] : $this->humanize($builder->getName()))

@webmozart
Symfony member

Fixed in the referenced PR.

@fabpot fabpot added a commit that referenced this issue Feb 21, 2013
@fabpot fabpot merged branch bschussek/issue6862 (PR #7150)
This PR was merged into the 2.0 branch.

Commits
-------

f8812b2 [Form] Fixed "label" option to accept the value "0"

Discussion
----------

[Form] Fixed "label" option to accept the value "0"

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

@fabpot: This commit will cause troubles when merging 2.0 into 2.1 and up. Tell me if you need help upon conflict resolution.
37d0491
@fabpot fabpot closed this Feb 21, 2013
@fabpot fabpot added a commit that referenced this issue Feb 22, 2013
@fabpot fabpot merged branch bschussek/issue6862 (PR #7154)
This PR was merged into the 2.1 branch.

Commits
-------

00fbb7e [Form] Added test for "label" option to accept the value "0"

Discussion
----------

[Form] Added test for "label" option to accept the value "0"

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #6862
| License       | MIT
| Doc PR        | -
f61295d
@mmucklo mmucklo pushed a commit that referenced this issue May 23, 2013
@fabpot fabpot merged branch bschussek/issue6862 (PR #7150)
This PR was merged into the 2.0 branch.

Commits
-------

f8812b2 [Form] Fixed "label" option to accept the value "0"

Discussion
----------

[Form] Fixed "label" option to accept the value "0"

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

@fabpot: This commit will cause troubles when merging 2.0 into 2.1 and up. Tell me if you need help upon conflict resolution.
67d21e1
@mmucklo mmucklo pushed a commit that referenced this issue May 23, 2013
@fabpot fabpot merged branch bschussek/issue6862 (PR #7154)
This PR was merged into the 2.1 branch.

Commits
-------

00fbb7e [Form] Added test for "label" option to accept the value "0"

Discussion
----------

[Form] Added test for "label" option to accept the value "0"

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #6862
| License       | MIT
| Doc PR        | -
3523829
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.