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

json_decode(): integer overflow detected #334

Closed
wants to merge 2 commits into from
Closed

Conversation

RSol
Copy link

@RSol RSol commented Nov 27, 2015

json_decode(): integer overflow detected

@polyfractal
Copy link
Contributor

Sorry, we can't support this in ES-PHP 1.0. The JSON_BIGINT_AS_STRING constant was added in PHP 5.4.0, and ES-PHP 1.0 supports down to PHP 5.3.9. :(

There are also weird problems where certain versions (or all maybe?) of Ubuntu don't have the constant since they don't agree with the license used by the underlying library. It's complicated. The native PHP solutions to fix this look expensive, lots of regex'ing and parsing to attempt to find numbers (but avoid numbers inside of strings).

I'm inclined to say this should be the user's responsibility, if you know your numbers might be very large. It's simple to escape your own large numbers, but difficult/expensive to autodetect someone else's large numbers. And ES doesn't have BigInt support either, so you should be sending them as strings anyway.

@polyfractal
Copy link
Contributor

Oh boy, misread the code. This is for json_decode(), not encode, meaning you don't have a chance to encode bigints yourself (e.g. coming from ES).

@ezimuel
Copy link
Contributor

ezimuel commented Apr 19, 2019

I'm closing this PR due to long inactivity (our fault, sorry for that). @RSol I'll reopen it if you will ping me. Remember to sign the CLA, thanks!

@ezimuel ezimuel closed this Apr 19, 2019
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.

3 participants