Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:75009 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 82854 invoked from network); 20 Jun 2014 00:30:40 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Jun 2014 00:30:40 -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.54 as permitted sender) X-PHP-List-Original-Sender: tyra3l@gmail.com X-Host-Fingerprint: 209.85.192.54 mail-qg0-f54.google.com Received: from [209.85.192.54] ([209.85.192.54:47389] helo=mail-qg0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 07/14-61414-FA083A35 for ; Thu, 19 Jun 2014 20:30:39 -0400 Received: by mail-qg0-f54.google.com with SMTP id q107so2822607qgd.13 for ; Thu, 19 Jun 2014 17:30:36 -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=5IzGK+z8dLlW6MboNCY3HwFOcrD+gyQBV/CTDLgO1J8=; b=Khc/5MdOt0H6dhPlN7jFy0eLSiq7nkXs2Y6KmYKnaX9LWR8dagj1nUMlK5e+U+Jhjs MmhS1GuI6YV45bAzj/+CT8Hp2pAC5TOrSP8Y6/vDbtH0rb6GKunmfDf0PUvGsD/8UAAy dQiU68gzYpAOJcx/Y34eLW0xPgZgSDDSLGSmgXtZaDQTHBsE/v3rTFez9aWWmijTYori dw6ijco8TQxh08z7rjMeHytaV126/QSctkssKfPqXelNjoePkagQSqoUpFPLtnHAH3ge MjC7iROELVyxjIfr12sq9DvBTM6w5jACYqNWcRXNrIwJjfGKkM6A79DWVDPsSsfMiu8X IMKw== MIME-Version: 1.0 X-Received: by 10.224.157.17 with SMTP id z17mr12355522qaw.72.1403224236711; Thu, 19 Jun 2014 17:30:36 -0700 (PDT) Received: by 10.140.17.77 with HTTP; Thu, 19 Jun 2014 17:30:36 -0700 (PDT) In-Reply-To: <53A2A9BD.1070603@sugarcrm.com> References: <53A1C722.9060501@fedoraproject.org> <53A21137.6010705@sugarcrm.com> <53A2A9BD.1070603@sugarcrm.com> Date: Fri, 20 Jun 2014 02:30:36 +0200 Message-ID: To: Stas Malyshev Cc: Julien Pauli , Remi Collet , PHP Internals Content-Type: multipart/alternative; boundary=089e0149caa62b661004fc399a84 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) --089e0149caa62b661004fc399a84 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Thu, Jun 19, 2014 at 11:13 AM, Stas Malyshev wrote: > Hi! > > > For me, it's a safe solution, however, it breaks BC, I think it's a > > no-go for 5.4 and 5.5. > > It breaks BC in something that never was part of the official API, never > was promised to work and works only by accident for internal classes. > Each such object can segfault at smallest provocation, so keeping them > is essentially requiring that we keep segfault compatibility. I don't > think we should promise that. > > > - Revert the BC break in 5.5 and 5.4 > > - Keep the segfault, we've been living with it for ages > > That's not the reason not to fix segfaults. Virtually every bug we're > fixing in the code we have been "living with for ages". That's not the > reason to keep them now that we know it segfaults. > > > - Patch the manual to clearly show one should never try to unserialize > > hand-made strings : we just do not support such behavior (thus, it > > could lead to segfaults) > > Well, here we contradict ourselves then - if we do not support such > behavior, why we are taking so much effort to enable it? Because > declaring that changing something even in small part is inacceptable > even if the price is known crashes in the application (and I wonder what > security people can make of it - uninitialized objects might be way > worse than just null pointer deref...) - that looks a lot like > supporting to me. So in what meaning we don't support it then? > -- > Stanislav Malyshev, Software Architect > SugarCRM: http://www.sugarcrm.com/ > (408)454-6900 ext. 227 > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > I've linked the discussion and provide a really compact summary (I think it is too compact) at https://bugs.php.net/bug.php?id=3D67072 I'm a bit indecisive about the current situation, because I think that we should fix the root cause of these problems, but I'm also wanna make sure that we don't totally criple phpunit-mock-objects and doctrine with a micro release. I think it would be safe to prohibit the unserialization of classes implementing the Serializable interface with the "O:" format, userland should use the "C:" format for these classes, we don't have that many classes outright denying the unserialization, and if a class validates the incoming data in the unserialize method, then the userland should make sure to provide appropriate data for the validation to pass. (Ofc. we should also make sure that we don't require more data, than necessary, see https://bugs.php.net/bug.php?id=3D67453&edit=3D1) Another topic would be to that internal classes (not implementing Serializable) can still be instantiated without the constructor call through the unserialize method (using the "O:" format), and we can't prohibit that, as it is/can be perfectly normal to unserialize an internal class previously properly instantiated and serialize, but we don't have the knowledge in the class to tell what is a properly serialized string, and what isn't for that given class. (Which means that allowing the internal classes to be instantiated via ReflectionClass::newInstanceWithoutConstructor() doesn't really introduces a new set of problems, it would just allow to shut yourself with reflection instead of an obscure unserialize trick. (Not saying we should do this, just mentioning that the problem already exists). I think that it would be a nice if we could add more validation for the internal classes __wakeup()/unserialize() methods for data which presence is mandatory for the class to be able to work, which would ofc. bother the life of the phpunit/doctrine users/devs, but it would only prevent the mocking those classes which would be unstable/dangerous previously when instantiated without the constructor call. --=20 Ferenc Kov=C3=A1cs @Tyr43l - http://tyrael.hu --089e0149caa62b661004fc399a84--