Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:75139 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 96472 invoked from network); 30 Jun 2014 09:43:13 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Jun 2014 09:43:13 -0000 Authentication-Results: pb1.pair.com header.from=tyra3l@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=tyra3l@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.41 as permitted sender) X-PHP-List-Original-Sender: tyra3l@gmail.com X-Host-Fingerprint: 209.85.216.41 mail-qa0-f41.google.com Received: from [209.85.216.41] ([209.85.216.41:62545] helo=mail-qa0-f41.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6D/82-07865-03131B35 for ; Mon, 30 Jun 2014 05:43:12 -0400 Received: by mail-qa0-f41.google.com with SMTP id cm18so6323343qab.0 for ; Mon, 30 Jun 2014 02:43:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=gVNAaiICC8xv0nfHeHqBw7PC32Ynxkw9YPELR7kG9WE=; b=DAx4LY6xoGvkvHR6qlftfn6dM0cAyb+dAByTZYyRJvOz8NeOlWKAowUcymP7z2va97 44e8NYTyEJxKLbL3/U1rVTteqqph+XxK2iyQo6kxVfSZnptAl9Yv/Y105sR8RvSId+5v DXIF+ThSi0ig+BhpnhJJSm+f3FTVDhS5jCv22Y1s17NM2tcCAdgGzmDHsl6JwkQ8YDdB IIlz8d0phdlHmNR+XgKbMAsFXAeOEzbihbM9tkVL+RYMSH0CDTJy5gfOuMN2Bx3tjWX4 4fHrIqHqH0fxGIlNyzzVygNj+lqkV5axV8LaQ+kFrUjCZYEKBWEsYvG8f2w6ek7+Jjem HrpQ== MIME-Version: 1.0 X-Received: by 10.140.102.12 with SMTP id v12mr430191qge.94.1404121389663; Mon, 30 Jun 2014 02:43:09 -0700 (PDT) Received: by 10.140.47.175 with HTTP; Mon, 30 Jun 2014 02:43:09 -0700 (PDT) Received: by 10.140.47.175 with HTTP; Mon, 30 Jun 2014 02:43:09 -0700 (PDT) In-Reply-To: <53B10D59.4060206@sugarcrm.com> References: <53A1C722.9060501@fedoraproject.org> <53A21137.6010705@sugarcrm.com> <53A2A9BD.1070603@sugarcrm.com> <53A3874E.20704@sugarcrm.com> <53A62AFF.4080302@sugarcrm.com> <53B10D59.4060206@sugarcrm.com> Date: Mon, 30 Jun 2014 11:43:09 +0200 Message-ID: To: Stas Malyshev Cc: Julien Pauli , Remi Collet , PHP Internals , Sebastian Bergmann , Marco Pivetta Content-Type: multipart/alternative; boundary=001a1134f152a7264104fd0a7c71 Subject: Re: [PHP-DEV] Re: Problems with the fix for the BC break introduced in 5.4.29 and 5.5.13 From: tyra3l@gmail.com (Ferenc Kovacs) --001a1134f152a7264104fd0a7c71 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 2014.06.30. 9:10, "Stas Malyshev" ezt =C3=ADrta: > > Hi! > > > Can anybody suggest a workaround for this problem? > > Should `ReflectionClass#newInstanceWithoutConstructor()` be enabled for > > those classes? > > If so, in 5.4/5.5? > > 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. > > > An additional problem is when a userland class extends an internal clas= s > > AND implements the `Serializable` interface on its own. > > In such cases, knowing the serialization format is impossible for us, > > and `ReflectionClass#newInstanceWithoutConstructor()` still cannot be used. > > Again, I would like to strongly suggest not using serialization format > for hacks. It's just not what it's for, and we already suffering the > consequences. We need some other solution here. Let's start with this: > what gives us the guarantee that internal class which is extended by > userland class will be found in proper state without calling the ctor? currently nothing. we could 1, make sure that every internal class is fine without the constructor (lazy initiation for example). this would be probably the most work. 2, we could make it mandatory or allow internal classes to opt-in to mandatory that the base constructor is always called. 3, we could turn the mandatory contructors final. 1, would allow us to keep instantiating the internal classes without constructors, but it would be error prune imo. 2/3 would could defend against the segfaults/etc but would be a pita to the userland. I think that the mid/long range solution should be to provide a way to dynamically create objects which doesn't inherit code from the original class/interface but the signature should be compatible (Sebastian opened a separate thread about using anonymous classes for this.), but I don't think we have time for that in 5.6. But we should provide an upgrade path, so the current status in 5.6 is a no-go imo. --001a1134f152a7264104fd0a7c71--