Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:68320 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 18734 invoked from network); 26 Jul 2013 11:33:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Jul 2013 11:33:57 -0000 Authentication-Results: pb1.pair.com smtp.mail=johannes@schlueters.de; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=johannes@schlueters.de; sender-id=unknown Received-SPF: error (pb1.pair.com: domain schlueters.de from 217.114.211.66 cause and error) X-PHP-List-Original-Sender: johannes@schlueters.de X-Host-Fingerprint: 217.114.211.66 config.schlueters.de Received: from [217.114.211.66] ([217.114.211.66:60874] helo=config.schlueters.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E1/E4-25917-4AE52F15 for ; Fri, 26 Jul 2013 07:33:57 -0400 Received: from [192.168.2.20] (ppp-93-104-4-146.dynamic.mnet-online.de [93.104.4.146]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by config.schlueters.de (Postfix) with ESMTPSA id 9875C65F7C; Fri, 26 Jul 2013 13:33:53 +0200 (CEST) To: Jakub Zelenka Cc: Stas Malyshev , Nikita Popov , PHP internals list , "nikic@php.net" In-Reply-To: References: <51F177E7.3020103@sugarcrm.com> <51F182D2.7030007@sugarcrm.com> <1374793278.3605.1436.camel@guybrush> <1374833069.3605.2106.camel@guybrush> Content-Type: text/plain; charset="UTF-8" Date: Fri, 26 Jul 2013 13:33:35 +0200 Message-ID: <1374838415.3605.2211.camel@guybrush> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] New handler for retrieving properties when object is serialized From: johannes@schlueters.de (Johannes =?ISO-8859-1?Q?Schl=FCter?=) On Fri, 2013-07-26 at 11:58 +0100, Jakub Zelenka wrote: > > > > So rather change the engine, which affects way more things and add yet > > another serialisation hook making it even more confusing what to use? > > > > > > > Yes I agree that the new hook is confusing. I think that what Gustavo said > would be actually much better. Having some flag that would say what is > the purpose of retrieving properties could be very useful. It's not just > serialization > but also casting object to array. There can be even more use cases > in the future. On top of it the hooks like get_gc and get_debug_info > could be part of it. But I would rather discuss this leter > when I send a patch. This means one has to touch every extension using those hooks. "more use cases in the future" means having to do this over and over again, for a feature I see little benefit in. Serializable was added precisely for the purpose to allow arbitrary internal classes to provide serializer logic. > > > > > > You're solution also depends on an API break and also changes the way > > the objects behave during serialization/unserialization. > > > > > Not sure what you mean by API break Breaking PHP's API. Requiring modifications to other extensions. > and changing the way the objects > behave? When you look to this pach > https://github.com/bukka/php-src/compare/date_serialize there shouldn't be > any difference in object behaviour. Or am I wrong? I haven't looked deeper but isn't your whole point to change the serialized representation of the object, to include all data "properly"? > By BC I meant the resulted string that you get after using serialize > function. If you use Serializable you get something that is prefixed by C: > . But if you have object, the prefix is O: . Please see this > http://3v4l.org/Sd8aT . I know the difference. So yes, new serialized files can't be properly read on old PHP. johannes