Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:36980 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 12147 invoked from network); 12 Apr 2008 01:01:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Apr 2008 01:01:09 -0000 Authentication-Results: pb1.pair.com smtp.mail=truth@proposaltech.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=truth@proposaltech.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain proposaltech.com from 66.51.199.86 cause and error) X-PHP-List-Original-Sender: truth@proposaltech.com X-Host-Fingerprint: 66.51.199.86 exvs01.ex.dslextreme.net Windows 2000 SP4, XP SP1 Received: from [66.51.199.86] ([66.51.199.86:13768] helo=EXVS01.ex.dslextreme.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 82/E0-07697-4D900084 for ; Fri, 11 Apr 2008 21:01:09 -0400 Received: from 69.239.100.91 ([69.239.100.91]) by EXVS01.ex.dslextreme.net ([192.168.7.220]) via Exchange Front-End Server owa.dslextreme.net ([192.168.7.126]) with Microsoft Exchange Server HTTP-DAV ; Sat, 12 Apr 2008 01:03:37 +0000 Received: from inspiron by owa.dslextreme.net; 11 Apr 2008 18:01:05 -0700 To: internals@lists.php.net In-Reply-To: <48000275.9090008@daylessday.org> References: <48000275.9090008@daylessday.org> Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Fri, 11 Apr 2008 18:01:04 -0700 Message-ID: <1207962064.5762.329.camel@inspiron.local> Mime-Version: 1.0 X-Mailer: Evolution 2.8.2 Subject: '1.8' == 1.8 can return false From: truth@proposaltech.com (Todd Ruth) I'm thinking there must be a bug in the heart of php causing this. I'll debug it, but I haven't looked at php source code in a few years and would like a tip as to which files are involved in evaluating "==". Here is a fragment from my code and the output: ... print "
\n";
var_dump($max);
var_dump($nms);
var_dump($nms == $max);
$max = (float)$max;
$nms = (string)$nms;
var_dump($max);
var_dump($nms);
var_dump($nms == $max);
$max = (string)$max;
$nms = (float)$nms;
var_dump($max);
var_dump($nms);
var_dump($nms == $max);
print "
\n"; ... string(3) "1.8" float(1.8) bool(false) float(1.8) string(3) "1.8" bool(true) string(3) "1.8" float(1.8) bool(true) I found this using php 5.2.3. I just upgraded to php 5.2.5 and am receiving the exact same result. Obviously, I can't reproduce it with a simple var_dump("1.8"==1.8). :( I guess something is getting corrupted, and I will add debug output until I find out what (or Murphy removes the problem by adding debug output; then I'm not sure what I'll do). Thanks for any tips on which files I should look at it. Thanks, Todd