note 13880 added to function.serialize.php

From: Date: Sat, 07 Jul 2001 20:22:28 +0000
Subject: note 13880 added to function.serialize.php
Groups: php.notes 
Request: Send a blank email to php-notes+get-15079@lists.php.net to get a copy of this message
There is a big problem with this function. If you have a few strings like, $hello[0] = "hello"; $hello[1] = "hi"; $hello[2] = "dear"; $bye[0] = "bye"; $bye[1] = "cya"; $bye[2] = "auf wiedersehen"; And you put those in an object like, $object->hello = $hello; $object->bye = $bye; And use the function $ser = serialize ($object); $ser will be, O:8:"stdClass":2:{s:5:"hello";a:3:{i:0;s:5:"hello";i:1;s:2:"hi";i:2;s:4:"dear";}s:3:"bye";a:3:{i:0;s:3:"bye";i:1;s:3:"cya";i:2;s:15:"auf wiedersehen";}} Thats OK, but when you use $string = unserialize($ser); the $string will become worthless. So far if I know isn't there any solution for this. Please mail me at pmzandbergen@yahoo.com if you have http://www.php.net/manual/en/function.serialize.php

« previous php.notes (#15079) next »