Skip to content

[Serializer] Handle true and false appropriately in CSV encoder #32007

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

Merged
merged 1 commit into from
Jun 14, 2019

Conversation

battye
Copy link
Contributor

@battye battye commented Jun 12, 2019

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

Previously, if true was passed in as a value to the CSV encoder then fputcsv() would correctly treat it as 1. However, if false was passed in, it would be treated as a blank value. null would also be treated as a blank value.

This fix makes it consistent so that true and false will map to 1 and 0, while null maps to an empty string.

@battye battye force-pushed the bugfix/csv-encoder branch 2 times, most recently from b3ce057 to 25f8411 Compare June 13, 2019 04:35
@battye battye force-pushed the bugfix/csv-encoder branch from 25f8411 to 805dd49 Compare June 13, 2019 08:43
@battye battye force-pushed the bugfix/csv-encoder branch from ae229e4 to 58a7f46 Compare June 14, 2019 04:05
@battye battye changed the title [Serializer] Handle true, false, null appropriately in CSV encoder [Serializer] Handle true and false appropriately in CSV encoder Jun 14, 2019
@fabpot fabpot force-pushed the bugfix/csv-encoder branch from 56c01b8 to 89cba00 Compare June 14, 2019 05:50
@fabpot
Copy link
Member

fabpot commented Jun 14, 2019

Thank you @battye.

@fabpot fabpot merged commit 89cba00 into symfony:3.4 Jun 14, 2019
fabpot added a commit that referenced this pull request Jun 14, 2019
…coder (battye)

This PR was squashed before being merged into the 3.4 branch (closes #32007).

Discussion
----------

[Serializer] Handle true and false appropriately in CSV encoder

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

Previously, if `true` was passed in as a value to the CSV encoder then `fputcsv()` would correctly treat it as 1. However, if `false` was passed in, it would be treated as a blank value. `null` would also be treated as a blank value.

This fix makes it consistent so that true and false will map to 1 and 0, while null maps to an empty string.

Commits
-------

89cba00 [Serializer] Handle true and false appropriately in CSV encoder
@nicolas-grekas nicolas-grekas added this to the 3.4 milestone Jun 17, 2019
This was referenced Jun 26, 2019
@battye battye deleted the bugfix/csv-encoder branch July 31, 2020 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants