Re: Why are serialized strings wrapped in double quotes? (s:<len>:"<string>")
| From: | Sanford Whiteman | Date: | Wed, 07 Feb 2024 16:34:55 +0000 |
| Subject: | Re: Why are serialized strings wrapped in double quotes? (s:<len>:"<string>") | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-122332@lists.php.net to get a copy of this message | ||
> I don't have the historical context, but I'm assuming that's it. PHPs
> serialization format is not efficient, and I don't think that was ever
> the primary focus.
Thanks Ilija. That'll have to suffice unless someone remembers a specific
decision (searching all the old Internals posts nothing came up). Most of my
readers are pretty junior but I hate to say something that conflicts with
their intuition.
— S.
On Wed, Feb 7, 2024 at 7:28 AM Ilija Tovilo <tovilo.ilija@gmail.com> wrote:
>
> Hi Sandy
>
> On Tue, Feb 6, 2024 at 9:19 PM Sanford Whiteman <figureonecpr@gmail.com> wrote:
> >
> > I'd like a little background on something we've long accepted: why
> > does the serialization format need double quotes around a string, even
> > though the byte length is explicit?
> >
> > Example:
> >
> > s:5:"hello";
> >
> > All else being equal I would think we could have just
> >
> > s:5:hello;
> >
> > Was this just to make strings look more 'stringy', even though the
> > format isn't meant to be human-readable?
>
> I don't have the historical context, but I'm assuming that's it. PHPs
> serialization format is not efficient, and I don't think that was ever
> the primary focus. If you need something more efficient, you can try
> https://github.com/igbinary/igbinary which is aimed to be a
> drop-in
> replacement.
>
> Ilija
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: https://www.php.net/unsub.php
>