Skip to content

[Form] Throw error if the number is too high on moneyTransformer #53948

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 23, 2024

Conversation

Fan2Shrek
Copy link
Contributor

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

The MoneyType does not handle high numbers when using 'model_type' => 'integer this leads to unexpected results :

Inputing for instance 111111111111111110,00 gets cast back to 9223372036854775807.

I have added a verification with \PHP_INT_MAX to throw an error in such case
I'm not sure if this is the best approach.

@Fan2Shrek Fan2Shrek force-pushed the fix-high-number-money-type branch from 542f755 to f08777b Compare February 15, 2024 15:08
@Fan2Shrek Fan2Shrek force-pushed the fix-high-number-money-type branch from f08777b to 9af694b Compare February 15, 2024 18:04
@Fan2Shrek Fan2Shrek force-pushed the fix-high-number-money-type branch from 9af694b to 27002c2 Compare February 15, 2024 18:32
@xabbuh xabbuh added the Form label Feb 17, 2024
@carsonbot carsonbot changed the title Throw error if the number is too high on moneyTransformer [Form] Throw error if the number is too high on moneyTransformer Feb 17, 2024
@fabpot
Copy link
Member

fabpot commented Feb 23, 2024

Thank you @Fan2Shrek.

@fabpot fabpot merged commit 6719e0a into symfony:7.1 Feb 23, 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.

MoneyType field and bad conversion to int
6 participants