Re: PHP 5.2: Serialization patch

From: Date: Thu, 07 Dec 2006 18:01:07 +0000
Subject: Re: PHP 5.2: Serialization patch
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to internals+get-26842@lists.php.net to get a copy of this message
Stefan Esser wrote:
Well, older version of PHP will be totally incapable of parsing it, creating problems for the many people who use serialized strings as a means of passing data between PHP applications. This would be an especially big problem if you would want to add it to a pre-6.0 release.
Uhmm you are missing the point. The point was that PHP 5.2.x can read data serialized with PHP 6. PHP 5.2.x only needs to be able to read it. Generating it is not necessary. At the moment it seems that data serialized in PHP 5.2.x is totally incompatible with PHP 6.
As 6.0 is not, to my knowledge, anywhere near release, what about this: 1. Stick a version number on the front of PHP6-serialized strings. BC can't break inside the 6.x family if there's nothing to be compatible with. 2. Don't change serialize() at all in PHP < 6.0.0. No version number, no extra escaping. 3. Add some mechanism to tell PHP6 to generate a PHP5-compatible binary string when serializing. I recommend an optional flag (or flags field) to serialize(). 4. Understand the new version number in PHP 5.2.1+. That would not touch existing serialization format. It would keep existing compatibility among the 4.x and 5.x family, and allow future PHPs to unambiguously determine how to parse the string. With the serialize() flag, you could explicitly generate old-style data from PHP6 if you really, really wanted to pass it back to PHP 5.2.0 or earlier. -- Chad Daelhousen "Television shepherds with living room sheep/ And I pray" --Temple of the Dog, "Wooden Jesus"

« previous php.internals (#26842) next »