Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:42722 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 35544 invoked from network); 20 Jan 2009 10:47:39 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Jan 2009 10:47:39 -0000 Authentication-Results: pb1.pair.com header.from=sv_forums@fmethod.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=sv_forums@fmethod.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fmethod.com from 69.16.228.148 cause and error) X-PHP-List-Original-Sender: sv_forums@fmethod.com X-Host-Fingerprint: 69.16.228.148 unknown Linux 2.4/2.6 Received: from [69.16.228.148] ([69.16.228.148:53813] helo=host.fmethod.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C3/E4-07734-8CBA5794 for ; Tue, 20 Jan 2009 05:47:37 -0500 Received: from [83.228.56.37] (port=3498 helo=pc) by host.fmethod.com with esmtpa (Exim 4.69) (envelope-from ) id 1LPE8r-0007bW-73 for internals@lists.php.net; Tue, 20 Jan 2009 04:47:33 -0600 Message-ID: To: "internals Mailing List" References: <1229538590.4955.15.camel@localhost> <28434894.20081217221911@marcus-boerger.de> Date: Tue, 20 Jan 2009 12:47:26 +0200 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="ISO-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.5512 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - host.fmethod.com X-AntiAbuse: Original Domain - lists.php.net X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - fmethod.com Subject: Re: [PHP-DEV] New function proposal: spl_object_id From: sv_forums@fmethod.com ("Stan Vassilev | FM") Hi, I had a talk with Marcus, and he has agreed on this proposed solution: 1) SPL generates a pseudo-random session id/mask (for the current request, do not confuse with $_SESSION), which consists of 32 random bytes/characters. 2) The object is and the handler pointer are used to create a unique identifier for the object, by padding each pointer to 16 bytes and joining them together. 3) The resulting byte sequence is XOR-red with the session mask so the object id/handler are not retrievable in userland, and the resulting sequence/string is returned. This is better than spl_object_hash for two reasons: 1) no printf of numbers, no expensive md5 hashing, no hex conversion. 2) no possible collisions Drawbacks: 1) might generate some non-printable chars after xor (but this wouldn't matter for operation). The idea above can be tweaked to solve this. The "32-bit string" format is to preserve compatibility with spl_object_hash, so it can replace it, instead of introducing a new similar function. I've had no time to look further into this, but Marcus seems to like the basic idea, so feel welcome... Regards, Stan Vassilev