Hi,

> -----Original Message-----
> From: julienpa...@gmail.com [mailto:julienpa...@gmail.com] On Behalf Of
> Julien Pauli
> Sent: Friday, July 31, 2015 4:24 PM
> To: PHP Internals <internals@lists.php.net>
> Subject: [PHP-DEV] Exposing object handles to userland
> 
> 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 ?
> 
Regarding the ID keywords, that reminds on 
https://docs.python.org/2/library/functions.html#id . While not everything is 
object in PHP, fe it could be interesting at least for the strings since we 
have interned strings. Maybe there were some wider range of useful information 
to provide in user land, not only related to objects.

Regards

Anatol


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to