ID: 38785
User updated by: m dot kurzyna at crystalpoint dot pl
-Summary: stripslashes is setlocale aware - decimal point
conversion
Reported By: m dot kurzyna at crystalpoint dot pl
Status: Open
-Bug Type: Documentation problem
+Bug Type: *Languages/Translation
Operating System: Linux
-PHP Version: Irrelevant
+PHP Version: 5.6.1
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[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