Specification for serialize()

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
It looks like I'm going to have to write programs in another language to
encode and decode php serialized data. I am really only interested in the
permutations of how it encodes multi-dimensioned arrays holding various data

Is there a formal spec for how serialize() does it's thing? I can certainly
intuit much of this from looking at the results but I don't want to miss
coding for some (obscure) data type.

Daniel Klein

Re: Specification for serialize()

The source is here if you need to check certain cases, not sure about
a spec document:

Function php_var_serialize_intern

FYI, here are some implementations for various languages:

http://hurring.com/scott/code/python/serialize /

http://csphpserial.sourceforge.net /

Java, JavaScript, C#
http://www.phprpc.org /

Java (Alpha release)
http://hurring.com/scott/code/java/serialize /

Macromedia ActionScript
http://sourceforge.net/projects/serializerclass /



Quoted text here. Click to load it

Re: Specification for serialize()

Quoted text here. Click to load it

Its fairly straightforward - if you serialize some stuff and write it
to disk you'll see - but it always feels wrong to me to use
serialization as a storage / messaging format since the format does
not seem to have a formal, published definition.

How painful could it it be to write the data in a format you define
yourself? Or use an off-the-shelf XML mapper?


Site Timeline