Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:9741 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 36278 invoked by uid 1010); 9 May 2004 07:43:56 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 36176 invoked from network); 9 May 2004 07:43:54 -0000 Received: from unknown (HELO dns10.mail.yahoo.co.jp) (210.81.151.143) by pb1.pair.com with SMTP; 9 May 2004 07:43:54 -0000 Received: from unknown (HELO ?192.168.1.7?) (219.180.130.6 with poptime) by dns10.mail.yahoo.co.jp with SMTP; 9 May 2004 07:43:52 -0000 X-Apparently-From: X-yjpVirusScan: Scanned Date: Sun, 09 May 2004 16:43:53 +0900 To: internals@lists.php.net Message-ID: <20040509162726.5B3C.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: Comparing objects on PHP5 From: rui_hirokawa@ybb.ne.jp (Rui Hirokawa) Hi, I think objects comparison in PHP5 has problems. Here is small sample code, 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