Re: Unserializes, inheritance and allows_classes
| From: | Marco Pivetta | Date: | Fri, 18 Jan 2019 01:15:33 +0000 |
| Subject: | Re: Unserializes, inheritance and allows_classes | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-103763@lists.php.net to get a copy of this message | ||
On Fri, Jan 18, 2019 at 2:13 AM Marcos Passos <marcospassos.com@gmail.com>
wrote:
> How would you fix this example, then? Perhaps we should add more examples
>> in the docs.
>>
>
> But it closes for extension preventing the serialization of instances not
> whitelisted. It may work for @internal or package private classes, but not
> for public classes.
>
That is precisely what this is designed for.
A subclass is a different type, with a world of possible broken things in
it: do not consider the subclass to be the same as a parent class: it's a
logical mistake.
Marco Pivetta
http://twitter.com/Ocramius
http://ocramius.github.com/