PHP 4.0 Bug #9186 Updated: string compare with "==" does not work correctly

From: Date: Thu, 15 Feb 2001 10:25:09 +0000
Subject: PHP 4.0 Bug #9186 Updated: string compare with "==" does not work correctly
Groups: php.dev 
Request: Send a blank email to php-dev+get-46630@lists.php.net to get a copy of this message
ID: 9186 Updated by: hholzgra Reported By: tom.anheyer@berlinonline.de Status: Analyzed Bug Type: Documentation problem Assigned To: Comments: this autoconversion is usefull when dealing with html form input (for which php is used every once in a while afaik :) as html has no numric input elements, just text maybe it would make sense to have this behaviour configurable in the ini file, but i'm afraid that this would only increase the WTF factor even more Previous Comments: --------------------------------------------------------------------------- [2001-02-15 05:07:35] tom.anheyer@berlinonline.de Ok, I accept this. But I don't think that is a good idea to compare apples with pears with the answer 'yes they are fruit' without any warning. --------------------------------------------------------------------------- [2001-02-15 04:32:00] zeev@php.net Ok, it should remain open as a documentation problem... --------------------------------------------------------------------------- [2001-02-15 04:31:01] zeev@php.net This is a defined behavior (and does have strong reasons). It's not a bug. If you're interested in a byte-by-byte string comparison, you should use strcmp(). --------------------------------------------------------------------------- [2001-02-09 11:10:17] zak@php.net Incorrectly flagged as bogus. --------------------------------------------------------------------------- [2001-02-09 10:59:10] tom.anheyer@berlinonline.de I think there is no reason to convert any type if both operands of the comparision are of the same type. It costs time and it's completely not necessary. This is a bug. I can not see any description of this behavior in the manual. The string type section descibes only what is happen if a string is converted. --------------------------------------------------------------------------- The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online. ATTENTION! Do NOT reply to this email! To reply, use the web interface found at http://bugs.php.net/?id=9186&edit=2

« previous php.dev (#46630) next »