note 99202 added to function.preg-replace
| From: | vallini at gmail dot com | Date: | Tue, 03 Aug 2010 07:34:35 +0000 |
| Subject: | note 99202 added to function.preg-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-171348@lists.php.net to get a copy of this message | ||
Don't ever do this error with preg_replace, with the nifty idea you're obtaining a string
containing only A-Z chars, numbers and spaces or apexes:
<?php
$escapedData=preg_replace('/[^0-9A-Za-z\s\']/', '', $escapedData); //remove
unwanted inputs
?>
If the data is escaped indeed, ready to be passed to the database, you have removed the escaping
slashes too, duh! Any apex may now prevent database write, or allow injection exploit.
Sanitization must be done before escaping, or may lead to whatever.
----
Server IP: 195.114.0.19
Probable Submitter: 78.13.104.200
----
Manual Page -- http://www.php.net/manual/en/function.preg-replace.php
Edit -- https://master.php.net/note/edit/99202
Del: integrated -- https://master.php.net/note/delete/99202/integrated
Del: useless -- https://master.php.net/note/delete/99202/useless
Del: bad code -- https://master.php.net/note/delete/99202/bad+code
Del: spam -- https://master.php.net/note/delete/99202/spam
Del: non-english -- https://master.php.net/note/delete/99202/non-english
Del: in docs -- https://master.php.net/note/delete/99202/in+docs
Del: other reasons-- https://master.php.net/note/delete/99202
Reject -- https://master.php.net/note/reject/99202
Search -- https://master.php.net/manage/user-notes.php