Re: Exposing object handles to userland

From: Date: Fri, 31 Jul 2015 20:08:56 +0000
Subject: Re: Exposing object handles to userland
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-87456@lists.php.net to get a copy of this message
On Fri, Jul 31, 2015 at 4:53 PM, Nicolas Grekas <
nicolas.grekas+php@gmail.com> wrote:

>
> 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 ?
>>
>
> I plead guilty for doing this, but php let me no better choice for now ;)
>
> The attached patch removes the XOR hashing for the object handle (it's
> useless, the "secret" is trivially guessed after parsing the output of
> var_dump).
>
> It would be awesome if this patch could be applied for php 7.0!
>
> Cheers,
> Nicolas
> <http://marc.info/?l=php-internals&m=141811755908008&w=2>
>
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php


I'd prefer to add a separate function spl_object_id, which directly returns
the handle. This should supersede spl_object_hash in the long run.
spl_object_hash does a bunch of pointless things that serve no purpose
other than making the function slower and making the result more bulky.

Nikita


Thread (49 messages)

« previous php.internals (#87456) next »