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

[HttpClient] Preserve float in JsonMockResponse #54146

Merged
merged 1 commit into from Mar 5, 2024

Conversation

Jibbarth
Copy link
Contributor

@Jibbarth Jibbarth commented Mar 4, 2024

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

Hello,

I am mocking an API Response that can send float in values :

{
    "values": 1.0
}

Converting this to a php array and giving it to JsonMockResponse return me an int after, because the missing json_encode flag to keep zero fraction, and leds to issue when I want to deserialize it into a float property.

In my mind it's a bugfix, but if it's considered as a new feature, I can target 7.1.

@Jibbarth Jibbarth force-pushed the fix/json-mock-response-float branch from 2e4751e to 4d120b8 Compare March 4, 2024 11:04
@stloyd
Copy link
Contributor

stloyd commented Mar 4, 2024

As this changes default settings and will change output then it's BC break unfortunately IMO.

@derrabus
Copy link
Member

derrabus commented Mar 4, 2024

As this changes default settings and will change output then it's BC break unfortunately IMO.

I agree. We can't make that change on 6.4. And if we want to implement it in 7.1, the new behavior must be opt-in.

@derrabus derrabus added Feature and removed Bug labels Mar 4, 2024
@nicolas-grekas
Copy link
Member

nicolas-grekas commented Mar 4, 2024

On my side I think we should consider this as a bugfix. The "BC break" aspect shouldn't impact production since the class is for mocks, so the risk is minimal IMHO. Also, this would fix the inconsistency with the "json" option, which does set the flag.

@derrabus derrabus added Bug and removed Feature labels Mar 5, 2024
@derrabus
Copy link
Member

derrabus commented Mar 5, 2024

Thank you @Jibbarth.

@derrabus derrabus merged commit 0523300 into symfony:6.4 Mar 5, 2024
8 of 9 checks passed
@Jibbarth Jibbarth deleted the fix/json-mock-response-float branch March 5, 2024 08:58
This was referenced Apr 3, 2024
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.

None yet

6 participants