note 99202 deleted from function.preg-replace by salathe

From: Date: Tue, 03 Aug 2010 07:52:46 +0000
Subject: note 99202 deleted from function.preg-replace by salathe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-171349@lists.php.net to get a copy of this message
Note Submitter: vallini at gmail dot com Reason: bad code ---- 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.

« previous php.notes (#171349) next »