Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:36981 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 46894 invoked from network); 12 Apr 2008 03:29:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Apr 2008 03:29:48 -0000 Authentication-Results: pb1.pair.com smtp.mail=rasmus@lerdorf.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=rasmus@lerdorf.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain lerdorf.com from 204.11.219.139 cause and error) X-PHP-List-Original-Sender: rasmus@lerdorf.com X-Host-Fingerprint: 204.11.219.139 mail.lerdorf.com Received: from [204.11.219.139] ([204.11.219.139:38533] helo=mail.lerdorf.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BB/B5-17092-9AC20084 for ; Fri, 11 Apr 2008 23:29:47 -0400 Received: from [192.168.200.148] (c-24-6-219-206.hsd1.ca.comcast.net [24.6.219.206]) (authenticated bits=0) by mail.lerdorf.com (8.14.2/8.14.2/Debian-4) with ESMTP id m3C3Tghv005816; Fri, 11 Apr 2008 20:29:42 -0700 Message-ID: <48002CA6.2070003@lerdorf.com> Date: Fri, 11 Apr 2008 20:29:42 -0700 User-Agent: Thunderbird 2.0.0.4 (Macintosh/20070604) MIME-Version: 1.0 To: Todd Ruth CC: internals@lists.php.net References: <48000275.9090008@daylessday.org> <1207962064.5762.329.camel@inspiron.local> In-Reply-To: <1207962064.5762.329.camel@inspiron.local> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] '1.8' == 1.8 can return false From: rasmus@lerdorf.com (Rasmus Lerdorf) There is no bug here. Please read: http://docs.sun.com/source/806-3568/ncg_goldberg.html -Rasmus Todd Ruth wrote: > 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.