Re: Why are serialized strings wrapped in double quotes? (s:<len>:"<string>")

From: Date: Fri, 09 Feb 2024 11:56:22 +0000
Subject: Re: Why are serialized strings wrapped in double quotes? (s:<len>:"<string>")
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-122353@lists.php.net to get a copy of this message
On Fri, Feb 9, 2024 at 8:13 AM Michał Marcin Brzuchalski <michal.brzuchalski@gmail.com> wrote: > > czw., 8 lut 2024 o 20:10 Sanford Whiteman <figureonecpr@gmail.com> > napisał(a): > > > Hi Michał, > > > > Thursday, February 8, 2024, 2:58:52 AM, you wrote: > > ... > > >O3:Foo:5{s4:date;O17:DateTimeImmutable:3{s4:date;s26:2024-02-08 > > > > >08:41:10.009742;s13:timezone_type;i:3;s8:timezone;s16:Europe/Amsterdam}s6:*foo;s11:Foo > > >bar > > > > > > >>baz;s8:Foobar;i:123456789;s3:tbl;a4{i:0;i:123;i:1;b:1;i:2;d:1.1;i:3;s3:baz}s8:*color;E12:Color:Yellow} > > > > > >This is still readable by humans and keep the size/length in all places > > >where needed. > > > > Amazing. To my eyes it's more readable too. > > > > Just wondering, while null is encoded just as N the booleans are encoded > with b:0 or b:1 > I can imagine this could also be just T and F > > > > Here's another one: leading numeral *implies* Integer 'i' (so only > > 'd', 'b' and 's<len>' are necessary). Or maybe that > > goes too far. > > > I was there in the very first link you can spot it but also believe this > goes too far. > > All above already goes far beyond what you initially asked and I know that. > I just like to share what can find. > > Cheers, > Michał Marcin Brzuchalski If I recall correctly, there is also a \0 (null character) hiding in the serialized string as well. It's incredibly annoying when copy/pasting as sometimes it gets stripped out. It might be worth removing as well. Robert Landers Software Engineer Utrecht NL

« previous php.internals (#122353) next »