#38785 [Opn->Csd]: float to string cast is always subject to locale settings
| From: | bjori@php.net | Date: | Sun, 03 Dec 2006 10:33:36 +0000 |
| Subject: | #38785 [Opn->Csd]: float to string cast is always subject to locale settings | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969374531@lists.php.net to get a copy of this message | ||
ID: 38785
Updated by: bjori@php.net
Reported By: m dot kurzyna at crystalpoint dot pl
-Status: Open
+Status: Closed
Bug Type: Documentation problem
Operating System: Linux
PHP Version: 5.1.6
-Assigned To:
+Assigned To: bjori
New Comment:
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.net/language.types.string
Previous Comments:
------------------------------------------------------------------------
[2006-09-12 08:40:50] tony2001@php.net
Reclassified as docu problem.
------------------------------------------------------------------------
[2006-09-12 00:05:25] m dot kurzyna at crystalpoint dot pl
Wrong version in prevous comment.
------------------------------------------------------------------------
[2006-09-12 00:04:46] 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-11 23:35:49] m dot kurzyna at crystalpoint dot pl
Description:
------------
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
point.
Reproduce code:
---------------
$float = 0.10; // $float is now float 0.10
setlocale(LC_ALL,'C');
$r = stripslashes($float); // $r is now string "0.10"
setlocale(LC_ALL,'pl_PL');
$r = stripslashes($float); // $r is now string "0,10"
Expected result:
----------------
No change in decimalpoint or explicit note in
documentation.
Actual result:
--------------
Provided in code example - change of decimal point
character.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=38785&edit=1