php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40360 current locale affects how json_encode encodes floats
Submitted: 2007-02-05 02:09 UTC Modified: 2007-02-05 03:16 UTC
From: ftl_ at freemail dot hu Assigned:
Status: Closed Package: Variables related
PHP Version: 5.2.0 OS: Gentoo Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: ftl_ at freemail dot hu
New email:
PHP Version: OS:

 

 [2007-02-05 02:09 UTC] ftl_ at freemail dot hu
Description:
------------
json_encode is using the decimal separator of the current locale instead of using "."
(similar to http://bugs.php.net/bug.php?id=40235)

Reproduce code:
---------------
<?php
var_dump(json_encode(1.2));
setlocale(LC_NUMERIC, 'hu_HU');
var_dump(json_encode(1.2));
?>

Expected result:
----------------
string(3) "1.2"
string(3) "1.2"

Actual result:
--------------
string(3) "1.2"
string(3) "1,2"

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-02-05 03:16 UTC] ftl_ at freemail dot hu
fixed in PHP 5.2.1RC5-dev (cli) (built: Feb  5 2007 00:22:58)
(sorry for this thoughtless bugreport.)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 06:01:29 2024 UTC