PHP 4.0 Bug #3017: if(strpos("Mozilla/4.7", "Mozilla") evaluates false!!!
| From: | cu at ulakbim dot gov dot tr | Date: | Tue, 21 Dec 1999 17:35:06 +0000 |
| Subject: | PHP 4.0 Bug #3017: if(strpos("Mozilla/4.7", "Mozilla") evaluates false!!! | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-13905@lists.php.net to get a copy of this message | ||
From: cu@ulakbim.gov.tr
Operating system: Solaris 2.6
PHP version: 4.0 Beta 3
PHP Bug Type: Misbehaving function
Bug description: if(strpos("Mozilla/4.7", "Mozilla") evaluates false!!!
I have Php 4.0b3 compiled as an Apache module. I have an agent-checking page, which behaves
according to the user agent.
$uagent = getenv(HTTP_USER_AGENT);
if (strpos($uagent, "Mozilla")) { // if Netscape or MSIE, it should find Netscape exactly
at 0th position
header("Location: ".$tunepage);
} else {
echo ("Incompatible agent");
}
Unfortunately strpos call above returns 0 and the if clause evaluates to False. Can you change the
function so that it returns a negative integer, say -1, or a real FALSE (as it says on the
documentation)?
Thank you,
Keep up the great work
Cuneyt Yilmaz