Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:99660 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 49631 invoked from network); 28 Jun 2017 17:41:47 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Jun 2017 17:41:47 -0000 Authentication-Results: pb1.pair.com header.from=me@kelunik.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=me@kelunik.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain kelunik.com from 81.169.146.161 cause and error) X-PHP-List-Original-Sender: me@kelunik.com X-Host-Fingerprint: 81.169.146.161 mo4-p00-ob.smtp.rzone.de Received: from [81.169.146.161] ([81.169.146.161:22873] helo=mo4-p00-ob.smtp.rzone.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 59/53-07609-85AE3595 for ; Wed, 28 Jun 2017 13:41:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1498671701; l=4908; s=domk; d=kelunik.com; h=Content-Type:Cc:To:Subject:Date:From:References:In-Reply-To: MIME-Version; bh=/PO0P/MWWiWGl5xn/gB5xXhOfFQ8QCWvq9IsEV9GXgQ=; b=uNcRPb+e4ZL+wkjui27bzUo6FnIIJOUm2IUMLebmD9Gd/CkburM4GBN2xjR1AMGdSd BQVtdtCe11WkTfMHwkM59U2HxTfAqFZ99zrBymOQi7VEZiG/WJmZ6pRvKAaHxgjDxHlU LCVkruFCcL/L4kCWXbxef0+AA0qFQv7OWSLMY= X-RZG-AUTH: :IWkkfkWkbvHsXQGmRYmUo9mls2vWuiu+7SLDup6E67mzuoNHBqX63Q== X-RZG-CLASS-ID: mo00 Received: by mail-oi0-f42.google.com with SMTP id p66so47405632oia.0 for ; Wed, 28 Jun 2017 10:41:41 -0700 (PDT) X-Gm-Message-State: AKS2vOyjbXUxd3ARPwS+VbPJi77WkI7eUbw96KoZzLZCxGVoL/ueMWgE GEs54OwH/PTetd1qj/k3gaBNJ0hVCA== X-Received: by 10.202.62.70 with SMTP id l67mr7311280oia.46.1498671701189; Wed, 28 Jun 2017 10:41:41 -0700 (PDT) MIME-Version: 1.0 Received: by 10.74.81.135 with HTTP; Wed, 28 Jun 2017 10:41:40 -0700 (PDT) In-Reply-To: References: Date: Wed, 28 Jun 2017 19:41:40 +0200 X-Gmail-Original-Message-ID: Message-ID: To: Rasmus Schultz Cc: PHP internals Content-Type: multipart/alternative; boundary="001a113ce09a6271ab055308b2f2" Subject: Re: [PHP-DEV] Binary (msgpack) serialize/unserialize From: me@kelunik.com (Niklas Keller) --001a113ce09a6271ab055308b2f2 Content-Type: text/plain; charset="UTF-8" 2017-06-28 11:04 GMT+02:00 Rasmus Schultz : > Back in 2014 there was an informal proposal on the mailing list to replace > PHP serialization with an efficient binary (msgpack) format. > > https://www.mail-archive.com/internals@lists.php.net/msg69870.html > > As argued back then, breaking serialize() and unserialize() is unacceptable > for many reasons. > > Meanwhile, the default session-storage, third-party cache libraries, etc. > continue to use serialize() and unserialize() with better options being > available only outside of the standard PHP run-times. > > Why don't we either: > > 1. adopt msg_pack() and msg_unpack() from the PECL package as standard > functions, or > > 2. add a new pair of functions, e.g. bin_serialize() and bin_unserialize() > to supersede the existing functions > > Or possibly both - that is, alias the pack/unpack functions with names > indicating they supersede the old un/serialize functions, but document the > new bin_* functions are using "an unspecified internal format". Uhm, why unspecified? > This way, > people can elect to use msgpack binary format now and in the future, or > elect to use msgpack now and possibly a different format in the future. > > Optionally the bin_* functions could lead with a version byte (or maybe a > 4-byte header) allowing backwards compatibility with future binary formats. > This way we don't risk ending up in the same situation again in 10 years if > we realize msgpack is bad for serialization for any reason. > > There are many other uses for a set of efficient (space and time) > un/serialization functions, for example when packing small payloads > (checksums, image dimensions, etc.) into URLs, when persisting data in > cookies, etc. > > Thoughts? > You could also just gzip larger payloads, I guess that should give a good reduction in size. Regards, Niklas --001a113ce09a6271ab055308b2f2--