PHP 4.0 Bug #5772: if ("" == "0") inconsistent behavior on IIS 4.0

From: Date: Mon, 24 Jul 2000 22:34:30 +0000
Subject: PHP 4.0 Bug #5772: if ("" == "0") inconsistent behavior on IIS 4.0
Groups: php.dev 
Request: Send a blank email to php-dev+get-25890@lists.php.net to get a copy of this message
From: steve@teamits.com Operating system: Windows NT 4.0 SP6a PHP version: 4.0.1pl2 PHP Bug Type: Misbehaving function Bug description: if ("" == "0") inconsistent behavior on IIS 4.0 If I use the following line on a UNIX server (running PHP 3.0.9), the test works as intended...meaning if "</body" is the first entry on the line, the test returns true. I am 99.9% sure I have the exact same line on my test machine running PWS 4.0 (I can't check from here). if (strpos(strtolower($line), '</body') == "0") { However, on IIS 4.0, if $line is a value that does not start with "</body", the test still returns true...I'm assuming this is because strpos() returns "" (false, which it does) and the parser compares that to "0" and assumes "0" is false, therefore the test "if (false=false)" returns a true value. I can get around this by changing the test to if (strpos(strtolower('a'.$line), '</body') > 1) { ...but it seems to me that the function/parser should work the same under PWS and IIS and UNIX. I was just confused why my page worked on the UNIX server and wouldn't work under IIS. BTW, I have tried both the CGI and ISAPI versions, and both behave the same way.

« previous php.dev (#25890) next »