note 26028 added to function.strstr
| From: | duke at rack1 dot php dot net | Date: | Tue, 15 Oct 2002 15:11:47 +0000 |
| Subject: | note 26028 added to function.strstr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-38119@lists.php.net to get a copy of this message | ||
strstr(), strchr(), strrchr() _and_ stristr() are _all_ broken as of 4.2.3:
$haystack = 'John Doe <john@doe.com>';
$needle_broken = '<';
$needle_ok = '@';
echo('haystack: ' . htmlspecialchars($haystack) . '<br />');
echo('strstr using needle_broken: ' . strstr($haystack, $needle_broken) . '<br
/>');
echo('strstr using needle_ok: ' . strstr($haystack, $needle_ok) . '<br
/>');
output:
broken:
ok: @doe.com>
only function that works properly with this caracter (also '>' and possibly others) is
strpos()
--
http://www.php.net/manual/en/function.strstr.php
http://master.php.net/manage/user-notes.php?action=edit+26028
http://master.php.net/manage/user-notes.php?action=delete+26028
http://master.php.net/manage/user-notes.php?action=reject+26028