Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:79278 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 46770 invoked from network); 28 Nov 2014 14:09:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Nov 2014 14:09:18 -0000 Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.169 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 209.85.212.169 mail-wi0-f169.google.com Received: from [209.85.212.169] ([209.85.212.169:35114] helo=mail-wi0-f169.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AA/FD-59154-D0288745 for ; Fri, 28 Nov 2014 09:09:17 -0500 Received: by mail-wi0-f169.google.com with SMTP id r20so21250609wiv.0 for ; Fri, 28 Nov 2014 06:09:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=L15D/GAzp6BKn6T8s/SMipuGBEwP9OE5/Ly1jJfOJsQ=; b=nnrmSc3CF8XQCjxX38hBMLUGTFbSv7Lw4FYwDs/LFXIKlHyMqV1ejMNTkxWArS8rE+ P2qnAMP+vBfjj2KevA7GsWnTkomVAP42Ema9FJBYJFepOY9uV4lOEM+YlAnJMLhOJxal H+djM2aEXcxNYvzp43YvnaI7MbRXzHpwl9kn5mlv0KflhZKSQiFCMuSJqqGRqR0XmLnN vMkz/1EHyDcAlpHxrv0yH6nYuLpdwqGCYySLgNd5HreXfruDWQrHhCbEH5kk3/P7Lg5H txQREhtCoav50mQr7+pwlMF4n/SlxRFfmxy6bRLn+3VuR2kEtArcYME+igaIIppu5MpJ zyWQ== X-Received: by 10.194.158.193 with SMTP id ww1mr70449435wjb.65.1417183753912; Fri, 28 Nov 2014 06:09:13 -0800 (PST) Received: from [192.168.0.148] ([62.189.198.114]) by mx.google.com with ESMTPSA id k5sm7835102wjn.1.2014.11.28.06.09.12 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Nov 2014 06:09:13 -0800 (PST) Message-ID: <547881D2.7050808@gmail.com> Date: Fri, 28 Nov 2014 14:08:18 +0000 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: internals@lists.php.net References: In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] New function: spl_object_id() or spl_object_handle() From: rowan.collins@gmail.com (Rowan Collins) Ferenc Kovacs wrote on 28/11/2014 13:51: > On Fri, Nov 28, 2014 at 2:14 PM, Sebastian Krebs > wrote: > >> 2014-11-28 2:13 GMT+01:00 Bostjan Skufca : >> >>> Hello everyone, >>> >>> this is a proposal to add new function to PHP core: spl_object_id() >>> >>> >>> The story: >>> ======== >>> Recently I was debugging some larger libraries and sorely missed a >> function >>> that would return an object ID. A function called spl_object_hash() >> exists, >>> but it returns identical hashes for equal objects. >> >> It returns unique IDs for existing objects. A hash is only reused only when >> the corresponding object was removed by the GC earlier. >> So actually asking me it makes more sense to "fix" the behaviour of >> spl_object_hash(), >> > yeah, the more I think about it the more I feel that the current > implementation is just a landmine. Is there any BC implication of changing the implementation? Or is it just that we don't know what the alternative should be? Looking at the implementation of spl_object_hash() [1] it already uses Z_OBJ_HANDLE_P(obj) as part of the output, so presumably that isn't enough to guarantee uniqueness anyway? (Which then leads to the question of what the advantage of an spl_object_id() function would actually be, if it's *less* unique than spl_object_hash()) [1] http://lxr.php.net/xref/PHP_TRUNK/ext/spl/php_spl.c#756 -- Rowan Collins [IMSoP]