Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:54764 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 57788 invoked from network); 21 Aug 2011 23:49:39 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Aug 2011 23:49:39 -0000 Authentication-Results: pb1.pair.com smtp.mail=davidkmuir@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=davidkmuir@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.210.172 as permitted sender) X-PHP-List-Original-Sender: davidkmuir@gmail.com X-Host-Fingerprint: 209.85.210.172 mail-iy0-f172.google.com Received: from [209.85.210.172] ([209.85.210.172:54992] helo=mail-iy0-f172.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 11/39-59369-399915E4 for ; Sun, 21 Aug 2011 19:49:39 -0400 Received: by iye7 with SMTP id 7so10728876iye.31 for ; Sun, 21 Aug 2011 16:49:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=gborylWwY6m/c1ZyvDaAy0gwb0Rl9mf2pVGzCaGHOgc=; b=W6GGVYylsuZ0RACXZzY479BowCaJ5iabYyElbKnT175oKBEtq3u5U6MZA9Sxr4gahv xaKkr2e+eEDp3nnR/6fLf9Ls7zRGI19O+xNedmugjWbJhLczM5JR3/0q+rqqELX3hAuA XGJx+zni+kInMJvFtLilJkTFkOCQqq9x7S1w4= Received: by 10.42.146.200 with SMTP id k8mr1805690icv.522.1313970575578; Sun, 21 Aug 2011 16:49:35 -0700 (PDT) Received: from [192.168.1.38] (static-93-136.net2000.com.au [203.32.93.136]) by mx.google.com with ESMTPS id x18sm3057052ibe.23.2011.08.21.16.49.33 (version=SSLv3 cipher=OTHER); Sun, 21 Aug 2011 16:49:34 -0700 (PDT) Message-ID: <4E51998B.9060301@gmail.com> Date: Mon, 22 Aug 2011 09:49:31 +1000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:6.0) Gecko/20110812 Thunderbird/6.0 MIME-Version: 1.0 To: internals@lists.php.net References: <4E4E48F6.8010107@php.net> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Activation of IGBinary serialization extension in 5.4 by default From: davidkmuir@gmail.com (David Muir) On 08/19/2011 10:54 PM, Ferenc Kovacs wrote: > On Fri, Aug 19, 2011 at 2:47 PM, Arpad Ray wrote: >> On Fri, Aug 19, 2011 at 1:40 PM, Ferenc Kovacs wrote: >>> On Fri, Aug 19, 2011 at 2:31 PM, Arpad Ray wrote: >>>> On Fri, Aug 19, 2011 at 1:04 PM, Ferenc Kovacs wrote: >>>>> the downside would be that if you want to serialize/unserialize the >>>>> data outside of php, your implementation should take care of this >>>>> prefix. >>>>> just a wild idea, but maybe useful: >>>>> instead of creating a prefix, we could serialize the passed data with >>>>> the given(php, igbinary, etc.) handler, then wrap the whole stuff into >>>>> an array which holds the name of the used handler and the serialized >>>>> data, and serialize this array with the old(php) serialize method. >>>>> this way the datablob would be always a valid serialized string, and >>>>> would be easier to get the serialize method than with the prefixing. >>>> If my old app couldn't read some newly serialized string, I'd rather >>>> it failed hard than apparently succeed but have the wrong data. >>>> >>> http://php.net/unserialize >>> In case the passed string is not unserializeable, FALSE is returned >>> and E_NOTICE is issued. >>> so if you unserialize from php, my suggestion would fail harder. >>> when you unserialize it from another mean (parsing it on your own, or >>> from a different language), you are right, it would produce a valid >>> but different result what you would expect, but this could be >>> documented, and I don't think that that many users do this, and maybe >>> they are using json/bson/igbinary already. >> I'm talking about unserialize() in an old (well, current) version of >> PHP - if it unserializes what is apparently a valid array there would >> be nothing to indicate it's actually a new version which it can't >> read. >> > I see, yeah, "old" clienst would still suffer from this, they would > get an array from unserialize what they didn't expect, and maybe some > data, what they cannot unpack (if it was packed with a method other > than the current) > the pro side is that it would be possible to handle this situation (if > you cannot upgrade a php instance for example for some reason) as you > could handle those situations (unserialize the data field to get the > original data, or use igbinary from pecl to decompress it, etc.) > I didn't feel too strong about this, just throwing ideas around. > Why not provide a userland fallback? eg: /IGBinary/unserialize() It could unserialize the string, albeit slowly, but still give you access to the data without needing the extension. At least that way you have something rather than nothing. David