note 76688 deleted from function.preg-match by tularis
| From: | tularis@php.net | Date: | Thu, 03 Jul 2008 21:39:04 +0000 |
| Subject: | note 76688 deleted from function.preg-match by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-141145@lists.php.net to get a copy of this message | ||
Note Submitter: razortongue
----
Maybe it will sound obvious, but I've encountered this a few times...
If you are using preg_match() to validate user input, remember about including ^ and $ to your regex
or take input from $matches[0] after successfully matching a pattern ie.
preg_match('/[0-9]+/', '123 UNION SELECT ... --') will return TRUE, but when you
it in a SQL statement, injected code will be probably executed(if you don't escape user
argument). Note that $matches[0] == '123', so it can be used as a valid input.