Skip to content

Enable JSON_PRESERVE_ZERO_FRACTION in jsonRequest method #59769

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
Feb 14, 2025

Conversation

raffaelecarelle
Copy link
Contributor

@raffaelecarelle raffaelecarelle commented Feb 13, 2025

Q A
Branch? 6.4
Bug fix? yes
New feature? no
Deprecations? no
Issues
License MIT

Updated the jsonRequest method to use JSON_PRESERVE_ZERO_FRACTION when encoding parameters.
This avoid unintended cast to int.

Test case:

$this->browser->jsonRequest('GET', 'url', ['cost' => 10.0]);

"cost" will be cast to int 10

@carsonbot
Copy link

Hey!

Thanks for your PR. You are targeting branch "7.3" but it seems your PR description refers to branch "7.2".
Could you update the PR description or change target branch? This helps core maintainers a lot.

Cheers!

Carsonbot

@carsonbot carsonbot added this to the 7.3 milestone Feb 13, 2025
@raffaelecarelle raffaelecarelle changed the title Enable JSON_PRESERVE_ZERO_FRACTION in jsonRequest method [BrowserKit] Enable JSON_PRESERVE_ZERO_FRACTION in jsonRequest method Feb 13, 2025
@raffaelecarelle raffaelecarelle changed the title [BrowserKit] Enable JSON_PRESERVE_ZERO_FRACTION in jsonRequest method [BrowserKit] Enable JSON_PRESERVE_ZERO_FRACTION in jsonRequest method Feb 13, 2025
@raffaelecarelle raffaelecarelle force-pushed the fix-preserve-zero-fraction branch from 961c9ae to b8fcd13 Compare February 13, 2025 13:58
@stof
Copy link
Member

stof commented Feb 13, 2025

this needs a regression tests (which would also help understand which issue is being fixed)

@raffaelecarelle raffaelecarelle changed the base branch from 7.3 to 7.2 February 13, 2025 14:01
@raffaelecarelle
Copy link
Contributor Author

this needs a regression tests (which would also help understand which issue is being fixed)

test added

@OskarStark
Copy link
Contributor

Will be cast to int 0? Or do you mean cast to int 10 in the pr description?

Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose we should merge this in 6.4

@carsonbot carsonbot changed the title [BrowserKit] Enable JSON_PRESERVE_ZERO_FRACTION in jsonRequest method Enable JSON_PRESERVE_ZERO_FRACTION in jsonRequest method Feb 13, 2025
@raffaelecarelle
Copy link
Contributor Author

Will be cast to int 0? Or do you mean cast to int 10 in the pr description?

10, sorry.

@fabpot fabpot modified the milestones: 7.3, 6.4 Feb 14, 2025
@fabpot fabpot changed the base branch from 7.2 to 6.4 February 14, 2025 11:23
@fabpot
Copy link
Member

fabpot commented Feb 14, 2025

Thank you @raffaelecarelle.

@fabpot fabpot merged commit 3062f05 into symfony:6.4 Feb 14, 2025
8 of 10 checks passed
This was referenced Feb 26, 2025
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