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

[4.x] Fix numbers not being cast in API filters #9511

Merged
merged 1 commit into from Feb 12, 2024

Conversation

jasonvarga
Copy link
Member

This fixes an issue where if you're trying to use numbers in filters, they'd be strings and your comparisons would end up incorrect.

For example:

/api/somewhere?filter[integer_field:gt]=5

This would end up with a query like where('integer_field', '>', '5'). You want 5 though, not "5".

This PR casts numeric values to either an integer or float.

@jasonvarga jasonvarga merged commit 8ee617d into 4.x Feb 12, 2024
36 checks passed
@jasonvarga jasonvarga deleted the api-numeric-cast-filter branch February 12, 2024 19:13
JohnathonKoster pushed a commit to JohnathonKoster/cms that referenced this pull request Feb 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant