Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

PHP JSON_PRESERVE_ZERO_FRACTION works on Sid, not Jessie

Ask for help with issues regarding the Installations of the Debian O/S.
Post Reply
Message
Author
mos
Posts: 1
Joined: 2015-09-29 07:37

PHP JSON_PRESERVE_ZERO_FRACTION works on Sid, not Jessie

#1 Post by mos »

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?

Post Reply