Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:76152 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 67157 invoked from network); 25 Jul 2014 22:47:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Jul 2014 22:47:29 -0000 Authentication-Results: pb1.pair.com smtp.mail=tyra3l@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=tyra3l@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.51 as permitted sender) X-PHP-List-Original-Sender: tyra3l@gmail.com X-Host-Fingerprint: 209.85.192.51 mail-qg0-f51.google.com Received: from [209.85.192.51] ([209.85.192.51:56626] helo=mail-qg0-f51.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 73/C0-08559-F7ED2D35 for ; Fri, 25 Jul 2014 18:47:28 -0400 Received: by mail-qg0-f51.google.com with SMTP id a108so5745034qge.24 for ; Fri, 25 Jul 2014 15:47:32 -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=eIWn2LttIIJjEm/D0aeTo2ppj2jNK/kpM+rD5hyMVQ4=; b=l8PRENlyOt1ErYT/d/lIxqpm61KiANNjphAvS2eniQPB6Tl/JJUCV4dTWsTo+98phy 06fn274WU3QLMmWDZPmCXcAak8a9q/CGqr7kSCmtVbNb8AeQFdHOkfRw5D8e9jvtiRPC wHEWht5ZNiWwIW6ZnYsIgavVAIKauVE+ckMFMaEj/5yEiijwtJl9cC6Pbq8ho37AHYfR jtgoBBd3hV7dWx0KIxO5pfjEdaoZzxqGRczESaAxk39papJq+Gk4nZRDiwlG7//4jYei q1khBaSn7w+a1gNpIZrbDe0+LeHBuSe9eXer6OowBAF3PvGZsyNmnqocqaq1BEgSl/eh yAIQ== MIME-Version: 1.0 X-Received: by 10.224.161.129 with SMTP id r1mr11268082qax.86.1406328452079; Fri, 25 Jul 2014 15:47:32 -0700 (PDT) Received: by 10.140.102.111 with HTTP; Fri, 25 Jul 2014 15:47:31 -0700 (PDT) In-Reply-To: <53D2DA3B.9020308@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> <53D2DA3B.9020308@sugarcrm.com> Date: Sat, 26 Jul 2014 00:47:31 +0200 Message-ID: To: Stas Malyshev Cc: Alexey Zakhlestin , Marco Pivetta , Sebastian Bergmann , Julien Pauli , Remi Collet , PHP Internals Content-Type: multipart/alternative; boundary=089e01538694d2e6c104ff0c5b2b Subject: Re: [PHP-DEV] Problems with the fix for the BC break introduced in 5.4.29 and 5.5.13 From: tyra3l@gmail.com (Ferenc Kovacs) --089e01538694d2e6c104ff0c5b2b Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Sat, Jul 26, 2014 at 12:29 AM, Stas Malyshev wrote: > Hi! > > > client) I see no reason to keep the limitation in > > the ReflectionClass::newInstanceWithoutConstructor() and allowing the > > instantiation of internal classes will provide a clean upgrade path to > > doctrine and co. > > I think we should ensure the objects will be in safe (i.e. no-crashing) > state following create_object even if ctor was not called. The question > is if we can ensure that and what would be the effort. > we already discussed this via moving the init logic to the create/clone handlers from __construct for such classes. > > As for upgrade path for doctrine, etc. - if we're talking about > something like test mocking, wouldn't something like: > > class Mock_Stub_FooClass extends FooClass { > function __construct() {} > } > $foo =3D new Mock_Stub_FooClass(); > yeah, that would work ofc, but as these libs seems to have instanitate arbitrary classes, that would require either generating files on the fly and including them or simply evaling them, but of those are a bit dirtier than using Reflection for the same job. > > solve the problem? I understand it's not argument against > newInstanceWithoutConstructor as essentially it does the same, just > saying newInstanceWithoutConstructor strictly speaking would not be > necessary? > true, but it can also be used to argue for loosening the restriction, why restrict something from Reflection, which is already possible from simple class extension. > > I think an approach for this would be to take pull 733 and make a script > (or a test) that takes all the classes we define internally (may be a > bit hard since some extensions need external libs, but we can check > those manually) and instantiate them using this (and all other > non-standard) method and try to call random methods and see if we get > any crashes. Julien already went over the potential classes and did the same thing (calling methods over them), the list of affected classes is just the previous one in this thread. > But we should be reasonably sure at least most common ones > would not crash if we enable this. > this change wouldn't introduce any crash, which isn't already possible through a subclass not calling parent::__construct, ofc. if we can fix the crashes before the final release that's nice, but I wouldn't say it is mandatory, how it was hidden for years(and even so that the remote trigger from unserialize is fixed). > > Another question would be if objects like COM would react to this > properly. But if not it would be possible to make them final too. > yeah, but I would rather fix them than move to final, as I mentioned before, it seems that some/most of the internal classes with final constructor are final so that this problem can't occur, but this doesn't a nice thing from OOP POV and also will cause problems if/when we introduce a reflection method removing final from classes/methods (this was already proposed not that long ago with a working patch but was turned down because other reasons). --=20 Ferenc Kov=C3=A1cs @Tyr43l - http://tyrael.hu --089e01538694d2e6c104ff0c5b2b--