note 69584 added to function.stripslashes
| From: | m dot kurzyna at crystalpoint dot pl | Date: | Mon, 11 Sep 2006 23:25:24 +0000 |
| Subject: | note 69584 added to function.stripslashes | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-117034@lists.php.net to get a copy of this message | ||
Be aware! stripslashes seems to be locale specific. I've run into this on standard variable
checks in an application which uses setlocale(). Consider following code:
<?php
$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"
?>
Note the change in decimal point character!
This is tested on PHP 5.1.6. For this to work you need to have used locales installed in test
enviroment. Insted of 'pl_PL' you can probably use any locale that uses non dot decimal
point character.
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 so
I'm going to submit a bug report on this.
----
Server IP: 83.64.128.68
Probable Submitter: 83.6.251.55 (proxied: 10.1.2.10)
----
Manual Page -- http://www.php.net/manual/en/function.stripslashes.php
Edit -- https://master.php.net/note/edit/69584
Del: integrated -- https://master.php.net/note/delete/69584/integrated
Del: useless -- https://master.php.net/note/delete/69584/useless
Del: bad code -- https://master.php.net/note/delete/69584/bad+code
Del: spam -- https://master.php.net/note/delete/69584/spam
Del: non-english -- https://master.php.net/note/delete/69584/non-english
Del: in docs -- https://master.php.net/note/delete/69584/in+docs
Del: other reasons-- https://master.php.net/note/delete/69584
Reject -- https://master.php.net/note/reject/69584
Search -- https://master.php.net/manage/user-notes.php