Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:79492 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 64870 invoked from network); 9 Dec 2014 09:31:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Dec 2014 09:31:48 -0000 Authentication-Results: pb1.pair.com header.from=nicolas.grekas@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=nicolas.grekas@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.171 as permitted sender) X-PHP-List-Original-Sender: nicolas.grekas@gmail.com X-Host-Fingerprint: 209.85.217.171 mail-lb0-f171.google.com Received: from [209.85.217.171] ([209.85.217.171:34730] helo=mail-lb0-f171.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2C/C2-39368-281C6845 for ; Tue, 09 Dec 2014 04:31:46 -0500 Received: by mail-lb0-f171.google.com with SMTP id n15so168482lbi.2 for ; Tue, 09 Dec 2014 01:31:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=Mr4SbcmHYCNwj5CtTRaibc1DnEj9SVYzScnhVeVRlwo=; b=JUQ24i1CYJk9erNnnxkLfabHQlJu6jtEHUb3+puBe5xx0QCy/I4PeZbq2pbzaR4r+t wgQKRE0y18tTNug5IxJ7C5y+858e57mnzBzqMD/W/a3oqdxnunf2MImIkMK8f3DzPlER dkCfo4mEPx1kCJTOt8sn+qmNgLGy78iBxctcCufQGeOXYii2CikRkA1M3GKNaSwDO2aP uPxiSG9VogZZ8K2D952IBRCX6Ljcf8Vtx0Mz8MzQd1wevCLfofaz5Rljr4oUWJu0ljQA bZuVGbdc56fSq2BulCiMnHZvXCgEqjCjNM7X2xgmtXZlBLxO1ww6UIhWw0XhdsE/L2zv Khdw== X-Received: by 10.152.8.82 with SMTP id p18mr21126774laa.25.1418117504012; Tue, 09 Dec 2014 01:31:44 -0800 (PST) MIME-Version: 1.0 Sender: nicolas.grekas@gmail.com Received: by 10.152.110.230 with HTTP; Tue, 9 Dec 2014 01:31:22 -0800 (PST) In-Reply-To: References: Date: Tue, 9 Dec 2014 10:31:22 +0100 X-Google-Sender-Auth: 1qkPXCPGxexajWmAk-p1E4L_49s Message-ID: To: Bostjan Skufca Cc: PHP Internals List Content-Type: multipart/alternative; boundary=001a11c3561e1397000509c536df Subject: Re: [PHP-DEV] New function: spl_object_id() or spl_object_handle() From: nicolas.grekas+php@gmail.com (Nicolas Grekas) --001a11c3561e1397000509c536df Content-Type: text/plain; charset=UTF-8 Hi this is a proposal to add new function to PHP core: spl_object_id() > IMHO this is a good idea: currently, var_dump has this super-power (and super-useful) capability of outputting a number that ease recognizing identical objects in dumps. This power should be transferred to userland devs so they can build their own tools. In fact, that's what I've done: since Symfony 2.6, you can dump using a userland function that (IMHO again) is more powerful than var_dump: http://symfony.com/doc/current/components/var_dumper/introduction.html In order to get an object's id, I use a trick that works for now: https://github.com/symfony/symfony/blob/2.6/src/Symfony/Component/VarDumper/Cloner/VarCloner.php#L258-L282 But I'd prefer replacing this trick by a dedicated function. So, with Julien Pauli, we worked on such a function. Symfony 2.6 also embeds a PHP extension that exposes more meta data about variables: https://github.com/symfony/symfony/tree/2.6/src/Symfony/Component/Debug/Resources/ext The function implemented in this extension is the root primitive that enables building a feature-full dumper, without resorting to tricks in PHP. Any interest in putting this in PHP core? Please feel free to do so, you have my vote :) Many thanks, Nicolas --001a11c3561e1397000509c536df--