On Thu, 2006-12-07 at 11:25 +0100, Thomas Seifert wrote:
> >From a users point of view: you must be kidding, eh?
> You want to break all the strings which were stored serialized in the
> 5.x-series? I can understand that it will break in php6 but not in some
> minor release.
> It will cause havoc with a lot of apps which can't read their cached- /
> meta-data anymore.
> 
> Also the performance drawback will get you a lot of angry users.
> Wasn't that just some versions before when the serialization has gotten
> a lot slower and created lots of problems?

This is a forwards compatibility issue, if we don't care about version
less than or equal to 5.2 being able to understand serialized data from
future version then there shouldn't be a problem with backwards
compatibility. I propose checking the start of the string to be
unserialized for the character v, if found then we can parse out a
version number up to the first found comma (or some other delimiter). So
for example we have

    echo serialize( array( 1, 2, 3, 4 ) );

        -> a:4:{i:0;i:1;i:1;i:2;i:2;i:3;i:3;i:4;}

    The new system could have:

        -> v:5.21,a:4:{i:0;i:1;i:1;i:2;i:2;i:3;i:3;i:4;}

Then in newer version of unserialize the version of 5.21 can be
extracted and the appropriate unserialization can occur. If no version
info is found then fall back to original semantics.

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to