-
-
Notifications
You must be signed in to change notification settings - Fork 33
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
Big integers should be returned as string (~JSON_BIGINT_AS_STRING) #9
Comments
Some cute regexp? |
This is what I have now – JanTvrdik@c302826 |
What to do with numbers such as |
What about E_USER_WARNING on big number? To force user enclose it in quotes as a string. JSON has the JSON_BIGINT_AS_STRING only for interoperability between 32-bit and 64-bit systems. |
The only sane way I know in PHP is the GMP extension. |
Please, don't. |
But still agreed, warning is the solution I would like to avoid. |
There is no sane way how to handle big numbers or have you forgotten about very large decimals? It should be string representation of given number or native PHP representation if possible. This is the simple solution We can add custom number parser into mix as a fallback or parameter with default set to sane parser. Quite easy, hard problem of what to do with numbers will be solved by user. In my magic ball I see this heading to custom number parser with default implementation that handles numbers of all colours and sizes. |
I think that it is better to return large integers as string instead of casting them to float.
What do you think? Any tips, how to efficiently decide whether string contains integer larger than MAX_INT?
The text was updated successfully, but these errors were encountered: