[dev] Serializing imp objects with Horde_Pack
    Ralf Lang 
    ralf.lang at ralf-lang.de
       
    Sat Oct  8 07:57:26 UTC 2022
    
    
  
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
    
    
More information about the dev
mailing list