PHP JSON_PRESERVE_ZERO_FRACTION works on Sid, not Jessie

Help with issues regarding installation of Debian

PHP JSON_PRESERVE_ZERO_FRACTION works on Sid, not Jessie

Postby mos » 2015-09-29 07:52

The PHP feature of json_encode JSON_PRESERVE_ZERO_FRACTION works on Sid but not on Jessie, despite having the correct PHP version above PHP 5.6.6 where the feature, according to the PHP manual, is implemented.

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)                                       


But running the same on Jessie fails saying JSON_PRESERVE_ZERO_FRACTION is undefined.
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?
mos
 
Posts: 1
Joined: 2015-09-29 07:37

Return to Installation

Who is online

Users browsing this forum: No registered users and 10 guests

fashionable