Using Homestead, I try to run the BIGINT example #5 from the PHP docs and I get an "Integer overflow notice". The flag JSON_BIGINT_AS_STRING is ignored, and the result is invalid (a maximum bigint of 9223372036854775807).
The Homestead instance has the following software stack:
- PHP 5.6.9
- JSON 1.3.6 with JSON-C headers and lib 0.11.99.
I then tested it on 3v4l, and it works. I don't know their JSON setup.
I then tested it on OS X's pre-installed PHP which is:
- PHP 5.5
- JSON 1.2.1 and no JSON-C headers/lib.
This works, too - just like in the docs.
Subsequently, I found this issue which leads to this commit and seems to be what's causing the problems here, but why does Remi invalidate >64bit numbers and call integer overflow, despite the default JSON extension (present on 3v4l and OS X natively) not doing that? Doesn't this violate the claim that it's a "drop in replacement"? In its current state, this extension, which is included by default in many installations, goes directly against PHP's official documentation.
Are there any good solutions for this that don't require internal alteration of libraries used, like Guzzle?
Edit: Upon searching further, I have found this which confirms that one developer's opinion is the cause of problems here.