note 14111 added to function.serialize.php
| From: | php-general at lists dot php dot net | Date: | Tue, 17 Jul 2001 22:39:50 +0000 |
| Subject: | note 14111 added to function.serialize.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-15508@lists.php.net to get a copy of this message | ||
BEWARE: if you serialize to store values on a database, and the variables you are serializing
already have the " (double-quote) char, you may have a problem. After serializing you will have
var delimiters as " and content " (double-quotes) escaped, but your databse may just treat
them like the same. You end up with a failed unserialize. You want something like:
a:5:{s:9:"this is a \"quote\"";a:1:{s:(ETC)
And not:
a:5:{s:9:"this is a "quote"";a:1:{s:(ETC)
So just make sure you double escape content quotes ...
It's simple, but i can't explain it any simpler =(
http://www.php.net/manual/en/function.serialize.php