note 61400 added to function.strpos
| From: | anonymous at example dot com | Date: | Thu, 02 Feb 2006 15:58:47 +0000 |
| Subject: | note 61400 added to function.strpos | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-102869@lists.php.net to get a copy of this message | ||
Beware of following the examples too closely...
$str = "abcdef";
echo strpos($str, 'b'); // outputs 1
however
$str = "abc\nef";
echo strpos($str, '\n'); // output nothing (FALSE)
Not a great way to try to stop PHP email injection attacks (as I found out).
Instead use
strpos($str, "\n")
because the escapes are processed only when using double quotes.
----
Server IP: 84.18.202.180
Probable Submitter: 87.112.12.255
----
Manual Page -- http://www.php.net/manual/en/function.strpos.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+61400
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+61400&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+61400&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+61400&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+61400&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+61400&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+61400&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+61400&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+61400&report=yes
Search -- http://master.php.net/manage/user-notes.php