Skip to content
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

Api4 - Convert field values to correct data type #16274

Merged
merged 1 commit into from
Jan 12, 2020

Conversation

colemanw
Copy link
Member

@colemanw colemanw commented Jan 10, 2020

Overview

The api historically returns everything as a raw string from the query instead of converting it to the correct variable type (bool, int, float). In php that doesn't matter much, but other languages like javascript are less forgiving. This fixes the types so that e.g. a boolean value will be false instead of "0" (which evaluates to true in javascript!).

Before/After

image

Comments

Technically this is a breaking change but api4 is still new and 99% of php code isn't going to care about variable types anyway, so I'm in favor of putting this in and documenting it in the changelog.

@civibot
Copy link

civibot bot commented Jan 10, 2020

(Standard links)

@civibot civibot bot added the master label Jan 10, 2020
@colemanw
Copy link
Member Author

colemanw commented Jan 11, 2020

Kind of amazing that this doesn't break a single unit test in (including all the v3 tests running on v4). That's how little php cares about variable types.

@eileenmcnaughton
Copy link
Contributor

Yes yes yes yes yes

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.

2 participants