php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46621 Float conversion in french breaks PHP
Submitted: 2008-11-19 19:32 UTC Modified: 2008-11-19 23:10 UTC
From: php dot net at spam dot lublink dot net Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.2.6 OS: Gentoo Linux
Private report: No CVE-ID: None
 [2008-11-19 19:32 UTC] php dot net at spam dot lublink dot net
Description:
------------
In French, it is written "0,05" not "0.05".  When in French, converting a string to a float causes values to be truncated.

I have two servers that I tested this on. One is running Gentoo, the other is running Ubuntu.

Reproduce code:
---------------
<?php
setlocale(LC_ALL, 'fr_FR');

var_dump (  (string)(float) "0.01" ) ;
var_dump (  (float)(string)(float)(string)(float) "0.01" ) ;


?>


Expected result:
----------------
string(4) "0,01"
float(0,01)


Actual result:
--------------
string(4) "0,01"
float(0)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-11-19 23:10 UTC] jani@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

Enough with the setlocale() and float "bug" reports..
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 17 14:04:04 2025 UTC