[dev] Serializing imp objects with Horde_Pack

Ralf Lang ralf.lang at ralf-lang.de
Sat Oct 8 12:35:53 UTC 2022


Am 08.10.22 um 09:57 schrieb Ralf Lang:
> Hello,
>
> I am currently reducing notice noise for PHP 8.1 and I encounter some 
> serialization issue.
> IMP uses a lot of serialization to session and it uses Horde_Pack to 
> provide a more concise representation than the native format.
>
> But PHP urges to upgrade to the new __serialize / __unserialize 
> methods that handle an array format.
>
> Normally I would do it this way: The part that picks attributes for an 
> array representation moves to __serialize/__unserialize. 
> serialize/unserialize call into these but wrap it into a call to the 
> serialize function to turn it into a string or unpack the string.
>
> That won't work in our case.
>
> Now there are two options:
>
> - Keep the whole Horde_Pack code as is and move it to the new method, 
> but wrap the resulting string into a single-element array. Unwrap that 
> array in the older serialize/unserialize methods.
>
> - Just handle the array inĀ  __serialize / __unserialize. Treat the 
> serialize() method as a normal function into which some higher level 
> of our code explicitly calls.
>
>
> As I feel some urgency to move forward I will first implement option 
> one. Depending on discussion, if any, I am happy to change of course.
>
> Regards
>
>
> Ralf
>
For reference: 
https://github.com/maintaina-com/imp/commit/10f0530e93d1b8999cb0f47d6fd0062fdb8b796f#diff-24c4415ee81dc7550b02295795e349e307fecf887074511a49b6134053e822d6R735


More information about the dev mailing list