> On 5 Nov 2014, at 16:23, Juan Basso <jrba...@gmail.com> wrote:
> 
> Andrea, I see your concerns about the bigint changes, but I am not sure if
> they are related. The PR just affect the encoding, not the decoding part.

Yes, I realise that.

> So if some Python system encodes a JSON using the decimal part it will be
> the same of PHP encoding using this new flag. So, if you think the decode
> can cause an issue on bigint, it needs a big concern for system
> interoperability on this part. Also, what I am proposing is not to change
> all integers in floats. What I am proposing with this flag is to make
> floats values (PHP zval) output as float in the JSON. It doesn't affect
> anything in the PHP variables.

JSON doesn’t have floats. It just has numbers, but unfortunately some 
poorly-designed JSON parsers treat the existence of a decimal point as 
significant. Again, I don’t see the benefit of adding .0 by default if it’s an 
integral float value. For dealing with poorly-written JSON parsers, there 
should of course be an option, but there’s no good reason which I can see to 
make it the default. If it’s the default, then it causes interoperability 
issues with 32-bit and 64-bit PHP, and forwards-compatibility issues with 
bigints. If it’s not the default, nothing changes and everything keeps working 
well.

--
Andrea Faulds
http://ajf.me/





--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to