Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:9776 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 40920 invoked by uid 1010); 9 May 2004 23:24:37 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 40756 invoked from network); 9 May 2004 23:24:35 -0000 Received: from unknown (HELO dns13.mail.yahoo.co.jp) (210.81.151.173) by pb1.pair.com with SMTP; 9 May 2004 23:24:35 -0000 Received: from unknown (HELO ?192.168.1.7?) (219.180.130.6 with poptime) by dns13.mail.yahoo.co.jp with SMTP; 9 May 2004 23:24:34 -0000 X-Apparently-From: X-yjpVirusScan: Scanned Date: Mon, 10 May 2004 08:24:33 +0900 To: Andi Gutmans Cc: internals@lists.php.net In-Reply-To: <5.1.0.14.2.20040509191720.035c6eb8@127.0.0.1> References: <20040509162726.5B3C.RUI_HIROKAWA@ybb.ne.jp> <5.1.0.14.2.20040509191720.035c6eb8@127.0.0.1> Message-ID: <20040510081537.966E.RUI_HIROKAWA@ybb.ne.jp> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Becky! ver. 2.08.01 [ja] Subject: Re: [PHP-DEV] Comparing objects on PHP5 From: rui_hirokawa@ybb.ne.jp (Rui Hirokawa) I performed the same test with HEAD (PHP 5.0.0RC3-dev (build: May 9 2004 10:16:50)). There are no E_NOTICE message now, but, the problems are still existing with RC2, PHP 4.3.6 same,not same,not same,same same,not same,not same,same PHP 5.0.0-CVS 2004/5/9 (ze1_compatibility_mode = Off) same,not same,not same,same not same,not same,not same,same PHP 5.0.0-CVS 2004/5/9 (ze1_compatibility_mode = On) same,same,not same,same not same,not same,not same,not same Rui On Sun, 09 May 2004 19:17:35 +0300 Andi Gutmans wrote: > Did you check HEAD? I fixed something to do with the comparison. if it > still doesn't work please let me know. > > Andi > > At 04:43 PM 5/9/2004 +0900, Rui Hirokawa wrote: > > >Hi, > > > >I think objects comparison in PHP5 has problems. > >Here is small sample code, > > > > >class Foo { > > var $v = 1; > > } > > class Boo { > > var $v = 1; > > } > > $a = new Foo; > > $b = new Foo; > > $c = new Boo; > > $d = new Foo; > > $d->v = 2; > > $e = $a; > > > >// value comparison > > echo $a == $b ? "same," : "not same,"; > > echo $a == $c ? "same," : "not same,"; > > echo $a == $d ? "same," : "not same,"; > > echo $a == $e ? "same" : "not same"; > > echo "\n"; > >// value and type comparison > > echo $a === $b ? "same," : "not same,"; > > echo $a === $c ? "same," : "not same,"; > > echo $a === $d ? "same," : "not same,"; > > echo $a === $e ? "same" : "not same"; > >?> > > > >The output from PHP4 and PHP5(ze1_compat on/off) is, > > > >PHP 4.3.6 : > > same,not same,not same,same > > same,not same,not same,same > > > >PHP 5.0.0RC2 zend.ze1_compatibility_mode=off : > > same,not same,not same,same > > (Notice: Object of class [Foo|Boo] could not be converted to integer) > > not same,not same,not same,same > > > >PHP 5.0.0RC2 zend.ze1_compatibility_mode=on : > > same,same,not same,same > > not same,not same,not same,not same > > > > > >The problem and question are, > >1. the different class is recognised as same in PHP5 (ze1_compat=on). > >2. the same object is recognised as different in PHP5 (ze1_compat=on). > >3. Why integer casting of object was implicitly applied in PHP5 > > (ze1_compat=off) ? > > -- Rui Hirokawa