Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:4767 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 88204 invoked by uid 1010); 9 Oct 2003 03:13:51 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 88171 invoked from network); 9 Oct 2003 03:13:50 -0000 Received: from unknown (HELO blobule.suds) (66.11.170.154) by pb1.pair.com with SMTP; 9 Oct 2003 03:13:50 -0000 Received: by blobule.suds (Postfix, from userid 501) id A3F2B2F717; Wed, 8 Oct 2003 23:13:49 -0400 (EDT) To: LingWitt@insightbb.com Cc: internals@lists.php.net In-Reply-To: References: Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8-3mdk Date: 08 Oct 2003 23:13:49 -0400 Message-ID: <1065669229.4960.16.camel@blobule.suds> Mime-Version: 1.0 Subject: Re: [PHP-DEV] Object Equality From: robert@interjinn.com (Robert Cummings) On Wed, 2003-10-08 at 10:21, LingWitt@insightbb.com wrote: > (Note: this email seems to relate to this list in my opinion, but I > have been chewed out before when posting such emails) > > I am using PHP 4.3.2, and it seems that testing objects for equality > (with == or ===) causes an internal bug when the objects have recursive > instance variables. That is, if the objects being tested have a > variable that is a reference to an object that has a variable that is a > reference to the first object, then the PHP processor dies. What can be > done about this? If this needs to be sent to another mailing list, > please let me know. Dirty hack -- create a unique ID instance variable for objects via their constructor. Implement equality check with: if( $obj1->uid == $obj2->uid ) { // Same object, yaaaaaaaaaaay! } Cheers, Rob. -- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------'