Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:87437 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 58260 invoked from network); 31 Jul 2015 14:24:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Jul 2015 14:24:23 -0000 Authentication-Results: pb1.pair.com header.from=julienpauli@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=julienpauli@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.179 as permitted sender) X-PHP-List-Original-Sender: julienpauli@gmail.com X-Host-Fingerprint: 209.85.220.179 mail-qk0-f179.google.com Received: from [209.85.220.179] ([209.85.220.179:34581] helo=mail-qk0-f179.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A2/12-47755-6158BB55 for ; Fri, 31 Jul 2015 10:24:23 -0400 Received: by qkfc129 with SMTP id c129so29597056qkf.1 for ; Fri, 31 Jul 2015 07:24:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:from:date:message-id:subject:to:content-type; bh=XvtpXXKDbTu6h+k/GquBIFsVFyfDYL/vIdRrpMKhENQ=; b=oiyndXM0cHafve3BL4ECu91LV+KCToaS9AbzkhQU4oCwRs7zWwVJF0X7PMOXKQMS4d qWqMrCsMSTFDhI8yOEXNWMUzL+bNQYGxv4uFj2bgezIKqkHAVby4mNeuOD4A71jpPQLf CYNFq0NONWLF+KmiEpGUzhz9MEDxsMTd5K8mGMXr7vQ9F1eUtv6byi+0oUh5YMBiM45o ITomcS29AmAYlojYHuO1yu/69811qMTNejbofkpn8hqpPs0RRrNsLlnysnBHCkFroMux JfStx6Jk7HBKHJw9MB56eLsvhCNHOIcelFezT3ehfp5i8eKFlLNp9BejxQ39prXVbg7g v72g== X-Received: by 10.55.24.219 with SMTP id 88mr4722162qky.54.1438352660105; Fri, 31 Jul 2015 07:24:20 -0700 (PDT) MIME-Version: 1.0 Sender: julienpauli@gmail.com Received: by 10.194.120.198 with HTTP; Fri, 31 Jul 2015 07:23:40 -0700 (PDT) Date: Fri, 31 Jul 2015 16:23:40 +0200 X-Google-Sender-Auth: ofiSMN1iM0PqPPfPmIiWINAVamo Message-ID: To: PHP Internals Content-Type: multipart/alternative; boundary=001a113b86405e1025051c2c932e Subject: Exposing object handles to userland From: jpauli@php.net (Julien Pauli) --001a113b86405e1025051c2c932e Content-Type: text/plain; charset=UTF-8 Hi people. I've been pinged many times to add a new spl_object_id() function to PHP, that would return the internal object handle of an object. Today, spl_object_hash() partially allows that, but adds many randomness to the result, which is not very cool to use later (why does it even add randomness ?). There has been topics about this subject. For example, at http://marc.info/?l=php-internals&m=141814350920452&w=2 Beeing able to get the object handle back in PHP userland would ease many tools, mainly debug-oriented tools. I know PHPUnit, Symfony and many big projects today make use of spl_object_hash() to identify objects. I also know people that print_r($an_object) and parse the output just to extract the object handle from there... Crazy isn't it ? Why couldn't we help those people by simply adding a new function that does the job ? Thoughts ? Julien.Pauli --001a113b86405e1025051c2c932e--