Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:50830 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 87704 invoked from network); 2 Dec 2010 17:11:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Dec 2010 17:11:37 -0000 Authentication-Results: pb1.pair.com header.from=jbondc@openmv.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=jbondc@openmv.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain openmv.com from 64.15.152.204 cause and error) X-PHP-List-Original-Sender: jbondc@openmv.com X-Host-Fingerprint: 64.15.152.204 mail.ca.gdesolutions.com Received: from [64.15.152.204] ([64.15.152.204:60577] helo=mail.ca.gdesolutions.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E7/82-07252-843D7FC4 for ; Thu, 02 Dec 2010 12:11:37 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.ca.gdesolutions.com (Postfix) with ESMTP id 2D8A85D18; Thu, 2 Dec 2010 12:11:34 -0500 (EST) X-Virus-Scanned: amavisd-new at gdesolutions.com Received: from mail.ca.gdesolutions.com ([127.0.0.1]) by localhost (mail.ca.gdesolutions.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PR3Oqt9foA7m; Thu, 2 Dec 2010 12:11:33 -0500 (EST) Received: from djbondc (modemcable083.208-56-74.mc.videotron.ca [74.56.208.83]) by mail.ca.gdesolutions.com (Postfix) with ESMTP id B2B0D5D16; Thu, 2 Dec 2010 12:11:33 -0500 (EST) To: "'Julien Pauli'" Cc: "'Andi Gutmans'" , References: <8757232E56758B42B2EE4F9D2CA019C9154CB7@US-EX2.zend.net> <006f01cb8f17$725bcdf0$571369d0$@com> In-Reply-To: Date: Thu, 2 Dec 2010 12:11:32 -0500 Message-ID: <002a01cb9243$f86788b0$e9369a10$@com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook 12.0 Thread-index: AcuQaIVxf0MgMnj5S4O8nzuT4FZ0ZQB2EJjw Content-language: en-ca Subject: RE: [PHP-DEV] Performance of buffer based functionality (JSON, AES, serialize()) From: jbondc@openmv.com ("Jonathan Bond-Caron") On Tue Nov 30 03:26 AM, Julien Pauli wrote: > I guess serialize mechanism cant use any char that can be part of a=20 > PHP variable. And "_" can. As property names respect binary=20 > compatibility, the only char that can be used to mark private=20 > properties is actually the NULL byte. Ping me if I'm wrong. >=20 Right, what I was proposing didn't make sense. After digging through the = source, say we have: class Foo { public $a =3D 1; protected $b =3D 2; private $c =3D 3; } Currently this is: O:3:"Foo":3:{s:1:"a";i:1;s:4:"=EF=BF=BD*=EF=BF=BDb";i:2;s:6:"=EF=BF=BDFoo= =EF=BF=BDc";i:3;} An alternative could be: O:3:"Foo":3:{s:1:"a";i:1;*;s:4:"b";i:2;_;s:6:"c";i:3;} Where "*;" is a marker for protected, "_;" is a marker for private It would involve some trickery in ext/standard/var_unserializer.re : "*;" { /* prepend =EF=BF=BD*=EF=BF=BD to the next key so that we have = zend_symtable_find("=EF=BF=BD*=EF=BF=BDb") */ } "_;" { /* prepend =EF=BF=BDFoo=EF=BF=BD to the next key so that we have = zend_symtable_find("=EF=BF=BDFoo=EF=BF=BDc") */ } Just a thought if someone wants to refactor it / look into performance, = I believe that approach would support both: O:3:"Foo":3:{s:1:"a";i:1;*;s:4:"b";i:2;_;s:6:"c";i:3;} O:3:"Foo":3:{s:1:"a";i:1;s:4:"=EF=BF=BD*=EF=BF=BDb";i:2;s:6:"=EF=BF=BDFoo= =EF=BF=BDc";i:3;}