nikic · GitHub

@nikic

jrfnl added a commit to PHPCompatibility/PHPCompatibility that referenced this pull request

Aug 20, 2019

jrfnl added a commit to PHPCompatibility/PHPCompatibility that referenced this pull request

Aug 20, 2019
From the RFC:
> **Creating objects in __unserialize()**
>
> Some people have expressed a desire to make __unserialize() a static method which creates and returns the unserialized object (rather than first constructing the object and then calling __unserialize() to initialize it).
>
> This would allow an even greater degree of control over the serialization mechanism, for example it would allow to return an already existing object from __unserialize().
>
> However, allowing this would once again require immediately calling __unserialize() functions (interleaved with unserialization) to make the object available for backreferences, which would reintroduce some of the problems that Serializable suffers from. As such, this will not be supported.
Refs:
* https://wiki.php.net/rfc/custom_object_serialization
* https://github.com/php/php-src/blob/3775d47eee38f3b34f800a0b23f840ec7a94e4c7/UPGRADING#L305-L315
* php/php-src#3761
* php/php-src@ d373c11 
Includes unit tests.
Related to 808

@jrfnl jrfnl mentioned this pull request

Aug 20, 2019

Merged

Read the original on github.com ↗