|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #38785 float to string cast is always subject to locale settings
Submitted: 2006-09-11 23:35 UTC Modified: 2006-12-03 10:33 UTC
From: m dot kurzyna at crystalpoint dot pl Assigned: bjori (profile)
Status: Closed Package: Documentation problem
PHP Version: 5.1.6 OS: Linux
Private report: No CVE-ID: None
 [2006-09-11 23:35 UTC] m dot kurzyna at crystalpoint dot pl
Stripslashes seems to be locale specific. It changes 
decimal point character when used in enviroment with 
locales set.

I'm not shure is this a feature or a bug but it's 
something unexpected as it's not mensioned in the manual 
as far as I know. And it's easy to criple database input 
with this.

As a locale to observe this behaviour one can set probably 
enything that uses comma rather then dot for decimal 

Reproduce code:
$float = 0.10;   // $float is now float 0.10

$r = stripslashes($float);     // $r is now string "0.10"

$r = stripslashes($float);     // $r is now string "0,10"

Expected result:
No change in decimalpoint or explicit note in 

Actual result:
Provided in code example - change of decimal point 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-09-12 00:04 UTC] m dot kurzyna at crystalpoint dot pl
This behaviour is more general - it applyes to any float 
to string conversion wether it's explicit or implicit. 
There are some bugreports on this already though all are 
bound to some concrete functions.
 [2006-09-12 00:05 UTC] m dot kurzyna at crystalpoint dot pl
Wrong version in prevous comment.
 [2006-09-12 08:40 UTC]
Reclassified as docu problem.
 [2006-12-03 10:33 UTC]
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.

Added a note from strtod(3) to
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Wed Aug 17 16:05:45 2022 UTC