On 25-07-2013 18:42, Jakub Zelenka wrote:
I have just sent this PR:  https://github.com/php/php-src/pull/397

It's reaction to the comment from nikic in PR:
https://github.com/php/php-src/pull/393

The patch is about adding new object handler that is used when object is
serialized. Currently this needs to be done using get_properties which is
sometimes a bit over kill.

It's useful in situation if you only need to change properties for
serialization. It's very similar to get_debug_info that is used only in
specific situations (print_r...)


This seems too narrow a situation to warrant a new serialization method, in addition to the two we already have.

That said, there are two precedents:

* get_debug_info (variant for var_dump)
* get_gc (variant for garbage collection)

And anyway, if you really want to add special properties for serialization, you can use the same hack that was used before get_gc was available:

http://lxr.php.net/xref/PHP_5_3/ext/spl/spl_observer.c#297
(and http://lxr.php.net/xref/PHP_5_3/ext/spl/spl_observer.c#258 )

You can check for BG(serialize_lock) instead of GC_G(gc_active)

What I think is that we should add an extra parameter to get_properties instead of keeping adding these.

--
Gustavo Lopes


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

Reply via email to