Hi, On Fri, Sep 5, 2025 at 5:55 PM Nicolas Grekas <[email protected]> wrote:
> Hello internals, > > Following the discussion that started at > https://externals.io/message/128226#128456 I wrote this RFC to formalize > our consensus on the topic. > > TL;DR, this is about converting the deprecation of __sleep and __wakeup to > a documentation-based soft deprecation: > https://wiki.php.net/rfc/soft-deprecate-sleep-wakeup > > We just had a discussion privately about this and I came with one example that would be worth to add here. It is about storing the serialized string where application needs to care about working correctly with the old format. For example when object is serialized, that string is stored into database. So when the application is deployed, it should still work in the same way when unserializing the string. If __sleep is used to serialize private properties (not all but just some), then those property names are stored in the mangled format ("\x00" . self::class . "\x00" prefix). It means to make it compatible in __serialize, the application has to mangle property names - this can be done either manually prefixing the name or using get_mangled_object_vars and filter the mangled names. Alternatively it could use __serialize with the new names but then it will need to deal with new and old (mangled) formats in __unserialize. In any case it means that the users will be required to deal with the mangled property name and get some understanding of mangling. Kind regards, Jakub
