This works as expected on Sid.
Code: Select all
$ php -r "echo json_encode(1.0);"
1
$ php -r "echo json_encode(1.0, JSON_PRESERVE_ZERO_FRACTION);"
1.0
$ php --version
PHP 5.6.13-2 (cli)
Code: Select all
$ php -r "echo json_encode(1.0);"
1
$ php -r "echo json_encode(1.0, JSON_PRESERVE_ZERO_FRACTION);"
PHP Notice: Use of undefined constant JSON_PRESERVE_ZERO_FRACTION - assumed 'JSON_PRESERVE_ZERO_FRACTION' in Command line code on line 1
PHP Warning: json_encode() expects parameter 2 to be long, string given in Command line code on line 1
$ php --version
PHP 5.6.13-0+deb8u1 (cli) (built: Sep 8 2015 12:13:31)
$ uname -a
Linux sweet 3.16.0-4-686-pae #1 SMP Debian 3.16.7-ckt11-1+deb8u3 (2015-08-04) i686 GNU/Linux
Is this likely to be a diff in the builds or is it something I can correct at my installation?
Is it the debian package or the PHP distribution itself?
PHP is installed through apt-get.
Any thoughts on how to deal with this?