Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:9630 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 30804 invoked by uid 1010); 2 May 2004 15:41:06 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 30682 invoked from network); 2 May 2004 15:41:04 -0000 Received: from unknown (HELO mail.zend.com) (192.117.235.230) by pb1.pair.com with SMTP; 2 May 2004 15:41:04 -0000 Received: (qmail 6629 invoked from network); 2 May 2004 15:40:57 -0000 Received: from int.zend.com (HELO AndiNotebook.zend.com) (10.1.1.1) by int.zend.com with SMTP; 2 May 2004 15:40:57 -0000 Message-ID: <5.1.0.14.2.20040502184046.03a5d4e8@127.0.0.1> X-Sender: andi@127.0.0.1 X-Mailer: QUALCOMM Windows Eudora Version 5.1 Date: Sun, 02 May 2004 18:40:56 +0300 To: Hans Lellelid ,internals@lists.php.net In-Reply-To: <408FE90F.3070406@appliedsec.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Subject: Re: [PHP-DEV] == object comparison bug? From: andi@zend.com (Andi Gutmans) References: <408FE90F.3070406@appliedsec.com> Thanks for the detailed report. This should be fixed in the latest CVS. Andi At 01:25 PM 4/28/2004 -0400, Hans Lellelid wrote: >I'm using PHP5.0.0RC2. I saw that there was a similar question posted, >but apparently that issue had already been fixed. > > >---code---------------------------- > >class File { > public $var; > function __construct($val) { > $this->var = $val; > } >} > >$t1 = new File("test"); >$t2 = new File("test"); > >print_r($t1); >print_r($t2); > >print "\$t1 == \$t2 ?"; >if ($t1 == $t2) { > print "YES\n"; >} else { > print "NO\n"; >} > > >---output---------------------------- > >File Object >( > [var] => test >) >File Object >( > [var] => test >) >$t1 == $t2 ? >Notice: Object of class File could not be converted to integer in >/var/www/apps/ddi/test.php on line 18 > >Notice: Object of class File could not be converted to integer in >/var/www/apps/ddi/test.php on line 18 >YES > > >I don't know why anything is being coverted to an _integer_. Is this >intended behavior? If so, how do I do a PHP4-style object contents >comparison? Using === doesn't produce any notice, but also means something >very different of course. > >Hans > >-- >PHP Internals - PHP Runtime Development Mailing List >To unsubscribe, visit: http://www.php.net/unsub.php