Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:68325 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 65957 invoked from network); 26 Jul 2013 21:02:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Jul 2013 21:02:06 -0000 Authentication-Results: pb1.pair.com smtp.mail=glopes@nebm.ist.utl.pt; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=glopes@nebm.ist.utl.pt; sender-id=unknown Received-SPF: error (pb1.pair.com: domain nebm.ist.utl.pt from 193.136.128.22 cause and error) X-PHP-List-Original-Sender: glopes@nebm.ist.utl.pt X-Host-Fingerprint: 193.136.128.22 smtp2.ist.utl.pt Linux 2.6 Received: from [193.136.128.22] ([193.136.128.22:47195] helo=smtp2.ist.utl.pt) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4E/EC-25917-BC3E2F15 for ; Fri, 26 Jul 2013 17:02:04 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp2.ist.utl.pt (Postfix) with ESMTP id 4A68B7000441; Fri, 26 Jul 2013 22:02:00 +0100 (WEST) X-Virus-Scanned: by amavisd-new-2.6.4 (20090625) (Debian) at ist.utl.pt Received: from smtp2.ist.utl.pt ([127.0.0.1]) by localhost (smtp2.ist.utl.pt [127.0.0.1]) (amavisd-new, port 10025) with LMTP id NNzv2NUtFsgK; Fri, 26 Jul 2013 22:02:00 +0100 (WEST) Received: from mail2.ist.utl.pt (mail.ist.utl.pt [IPv6:2001:690:2100:1::8]) by smtp2.ist.utl.pt (Postfix) with ESMTP id 5CF7C7000444; Fri, 26 Jul 2013 22:01:59 +0100 (WEST) Received: from [IPv6:2001:981:8103:d8:96de:80ff:fe7e:525f] (unknown [IPv6:2001:981:8103:d8:96de:80ff:fe7e:525f]) (Authenticated sender: ist155741) by mail2.ist.utl.pt (Postfix) with ESMTPSA id D3FBF200D077; Fri, 26 Jul 2013 22:01:58 +0100 (WEST) Message-ID: <51F2E393.5090206@nebm.ist.utl.pt> Date: Fri, 26 Jul 2013 23:01:07 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:22.0) Gecko/20100101 Thunderbird/22.0 MIME-Version: 1.0 To: =?UTF-8?B?Sm9oYW5uZXMgU2NobMO8dGVy?= , Jakub Zelenka CC: Stas Malyshev , Nikita Popov , PHP internals list , "nikic@php.net" 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> In-Reply-To: <1374847163.3605.2377.camel@guybrush> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] New handler for retrieving properties when object is serialized From: glopes@nebm.ist.utl.pt (Gustavo Lopes) On 26-07-2013 15:59, Johannes Schlüter 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) This is a gross misrepresentation. The vast majority of extensions will not care about this purpose, just like most extensions do not care about get_debug_info or get_gc or about the purpose in read_property. If a new purpose is added, this would not be any different than adding a new hook as long as: 1) the extension doesn't purposefully break forward compatibility, for example by doing switch(purpose) { ... default: panic(); } and 2) the new hook would default to get_properties, either by explicitly setting the pointer to get_properties in the standard handlers array or by having the engine fall back to get_properties (the last one was the solution adopted for get_debug_info and get_gc afaik). Yes, this would break extensions. But we never made any promises about source BC for extensions. In fact, we actually break it for every release, sometimes in rather subtle ways like in 5.4 (due to interned strings, and object properties storage). > So what is being proposed is to extend our already too large API with > yet another way of doing something for edge cases for which we have a > good solution for the general case already. > Alternatively, could the problem perhaps be mitigated by making available some utility functions for serializing native types? -- Gustavo Lopes