Re: Problems with the fix for the BC break introduced in 5.4.29 and 5.5.13
| From: | Alexey Zakhlestin | Date: | Mon, 30 Jun 2014 18:10:45 +0000 |
| Subject: | Re: Problems with the fix for the BC break introduced in 5.4.29 and 5.5.13 | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-75148@lists.php.net to get a copy of this message | ||
On 30 Jun 2014, at 11:10, Stas Malyshev <smalyshev@sugarcrm.com> wrote:
> I think we should move away from the practice of using serializer for
> something it was never made for, namely a weird way of instantiating
> classes. Serializer should be working only with serialized data.
> Now, the question is can we instantiate the internal class without
> calling its ctor, and the answer here would probably be "no", at least
> not safely. While in the case of user class the engine can be reasonable
> sure even if you don't call the ctor the basic structures are
> initialized properly, in the case of the internal class all bets are
> off. I'm not sure yet which use cases require ctor not to be called, but
> I'm not sure how we can deliver on internal classes here.
Sorry, I’m a bit late to discussion and might be missing something obvious.
As far as I remember, internal classes have 2 constructors.
1. implementation of __construct() function
2. create_object hook
It should be possible to keep unsafe stuff in create_object which is called unconditionally and
leave safe initialisation in __construct.
so, in case when __construct is not called object will have properties initialised with nulls, empty
strings, etc.
I understand that is a lot of work on case-by-case basis but it is doable.
--
Alexey Zakhlestin
CTO at Grids.by/you
https://github.com/indeyets
PGP key: http://indeyets.ru/alexey.zakhlestin.pgp.asc
Attachment: [application/pgp-signature] Message signed with OpenPGP using GPGMail signature.asc
Attachment: [application/pgp-signature] Message signed with OpenPGP using GPGMail signature.asc