Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:68323 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 37938 invoked from network); 26 Jul 2013 15:18:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Jul 2013 15:18:54 -0000 Authentication-Results: pb1.pair.com smtp.mail=jakub.php@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=jakub.php@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.128.53 as permitted sender) X-PHP-List-Original-Sender: jakub.php@gmail.com X-Host-Fingerprint: 209.85.128.53 mail-qe0-f53.google.com Received: from [209.85.128.53] ([209.85.128.53:53926] helo=mail-qe0-f53.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 59/38-25917-C5392F15 for ; Fri, 26 Jul 2013 11:18:53 -0400 Received: by mail-qe0-f53.google.com with SMTP id f6so1042036qej.26 for ; Fri, 26 Jul 2013 08:18:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=nWQg8kKtWj5GqcSUf42pfmnIJtTJeGSkCjtTi5/sihg=; b=eaL1b27yW9vY+OGASakyOY6qNRpNOuvAjJk7eVBw2vxqulY8WfxxHoe4tCCsEJlA7W 0OGORgv5vypI8H2XV7C3onLjV3l/azKcCOn9CEL3QwHDMoDLmHbipGQhqPPG6fuyUPUU XGTFtJ9ClOxAVCOkPiVV30U5Vn89IN9vOukFOHK6RTfOqqDOJrpJiOfSaCP0YFWpB73y +kr68OptauNncvq6RfgMcHOOPmDAfvd9tuoUEJINMtt5Hycb952choO3f7KWajBzeFso YaGa0+GNVkDt8BKeGoa4GTxBtdbiJJ/4QtyLDDXTqTkQzywRE7tnoEggeuzjujDNJ9yP 88Mw== MIME-Version: 1.0 X-Received: by 10.224.15.205 with SMTP id l13mr29659566qaa.67.1374851930200; Fri, 26 Jul 2013 08:18:50 -0700 (PDT) Sender: jakub.php@gmail.com Received: by 10.224.178.69 with HTTP; Fri, 26 Jul 2013 08:18:50 -0700 (PDT) In-Reply-To: <1374847163.3605.2377.camel@guybrush> References: <51F177E7.3020103@sugarcrm.com> <51F182D2.7030007@sugarcrm.com> <1374793278.3605.1436.camel@guybrush> <1374833069.3605.2106.camel@guybrush> <1374838415.3605.2211.camel@guybrush> <1374847163.3605.2377.camel@guybrush> Date: Fri, 26 Jul 2013 16:18:50 +0100 X-Google-Sender-Auth: nDb2Z_-01Zbd1gELDzIgKhQrhv0 Message-ID: To: =?ISO-8859-1?Q?Johannes_Schl=FCter?= Cc: Stas Malyshev , Nikita Popov , PHP internals list , "nikic@php.net" Content-Type: multipart/alternative; boundary=047d7bdc8e1ceb1d5d04e26ba8f1 Subject: Re: [PHP-DEV] New handler for retrieving properties when object is serialized From: bukka@php.net (Jakub Zelenka) --047d7bdc8e1ceb1d5d04e26ba8f1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Fri, Jul 26, 2013 at 2:59 PM, Johannes Schl=FCter wrote: > > Such a way for overloading is bad. This is painful on each update. If > there are different things to do use different hooks. The > implementations might call the same implementation but a "purpose" > option leads to a long term maintenance hell whenever there is a > change.(a tiny bit better would be using an enum instead of int as in > some situations compilers/analyzers might give a hint ... but still a > mess) > > Ok so probably better not to do that :) > But I still don't buy the argument for this hook. > > Typically internal classes use some C data structure for keeping their > internal state. Often actually in a form that it can not be represented > in zval. From that observation (after a few years of looking at phpsrc, > pecl external and close-source exts) Serializable is the preferred way > to serialize these in an efficient way (converting everything in zvals, > then serialize, finally freeing temporary data is a quite expensive > way ..) > I agree that Serializable is better for performance. The reason why I proposed this is to differentiate serialization properties from normal properties in cases where Serializable would require lots of coding for a small benefit (object is not serialized often) or it is not an options (DateTime - see bellow). > > So the purpose is to have a different serialized representation, so > there would be compatibility issues, similar to going to Serializable. > > Yeah but that serialized representation is exactly the same as the current representation (the serialized strings before the patch is exactly the same as the string after the patch :)). The difference is that get_properties returns empty HashTable now. The serialization is backward compatible though. I just want to find a solution for this problem. What would you do? Would you use Serialazable even if it breaks apps after updating PHP. Or would you still use get_properties (possibly with testing serialize_lock) ? Jakub --047d7bdc8e1ceb1d5d04e26ba8f1--