Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:30396 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 80438 invoked by uid 1010); 2 Jul 2007 04:34:17 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 80423 invoked from network); 2 Jul 2007 04:34:17 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Jul 2007 04:34:17 -0000 Authentication-Results: pb1.pair.com smtp.mail=stas@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=stas@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 63.205.162.114 as permitted sender) X-PHP-List-Original-Sender: stas@zend.com X-Host-Fingerprint: 63.205.162.114 unknown Windows 2000 SP4, XP SP1 Received: from [63.205.162.114] ([63.205.162.114:2366] helo=us-ex1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A6/A2-32240-54088864 for ; Mon, 02 Jul 2007 00:34:15 -0400 Received: from [127.0.0.1] ([192.168.17.6]) by us-ex1.zend.com with Microsoft SMTPSVC(6.0.3790.1830); Sun, 1 Jul 2007 21:34:10 -0700 Message-ID: <4688803D.80404@zend.com> Date: Sun, 01 Jul 2007 21:34:05 -0700 Organization: Zend Technologies User-Agent: Thunderbird 2.0.0.4 (Windows/20070604) MIME-Version: 1.0 To: Pavel Shevaev CC: Sebastian Bergmann , internals@lists.php.net References: <468519DC.8060502@widescreen.ch> <4685785E.5010709@zend.com> <585221804.20070701154538@marcus-boerger.de> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 02 Jul 2007 04:34:10.0770 (UTC) FILETIME=[3C4ACB20:01C7BC62] Subject: Re: [PHP-DEV] toString() and Object #ID From: stas@zend.com (Stanislav Malyshev) > Am I right in my guess that there's only a counter for each object > type? Still being not really unique this information could be very > useful and enough in many situations. It's more complicated than that. Basically what uniquely identifies the object is the tuple (handlers, ID) - it's more or less by definition since handlers decide what to do with an object based on ID. Now, if we talk about "pure" PHP objects (i.e. made by regular PHP user-defined classes, no tricks) then the handlers would be the same and the ID is unique. However, extensions can produce their own handlers and their own IDs, and they don't even have to adhere to the concept that (class, ID) should uniquely identify the object. I don't know of extension that creates different handler sets for the same class, but there's nothing in the engine preventing anybody from doing that - though I'm not sure it's that good an idea. So (class, ID) would probably work now, but is not guaranteed to work. Just ID would have good chance to break with some extensions. Yes, spl_object_hash uses the correct tuple - (handlers, ID). -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com