php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53507 json_encode of float value
Submitted: 2010-12-09 15:05 UTC Modified: 2010-12-11 16:08 UTC
From: johann at infomaniak dot ch Assigned: iliaa (profile)
Status: Closed Package: JSON related
PHP Version: 5.2.14 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
39 + 2 = ?
Subscribe to this entry?

 
 [2010-12-09 15:05 UTC] johann at infomaniak dot ch
Description:
------------
json_encode of float doesn't work when a locale is define which use comma (,) as separator (ex: fr_FR)


Test script:
---------------
$aReturn=array(
'fAmount' => 12.12
);

setlocale(LC_ALL, 'fr_FR');
print(json_encode($aReturn));

Expected result:
----------------
{"fAmount":12.12}

Actual result:
--------------
{"fAmount":12,12}

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-12-10 02:21 UTC] felipe@php.net
-Package: Systems problem +Package: JSON related
 [2010-12-11 16:08 UTC] iliaa@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: iliaa
 [2010-12-11 16:08 UTC] iliaa@php.net
Thank you for your bug report. This issue has already been fixed
in the latest released version of PHP, which you can download at 
http://www.php.net/downloads.php


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 17:01:29 2024 UTC