note 14111 deleted from function.serialize by aharvey
| From: | aharvey@php.net | Date: | Tue, 06 Nov 2012 02:01:59 +0000 |
| Subject: | note 14111 deleted from function.serialize by aharvey | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-191734@lists.php.net to get a copy of this message | ||
Note Submitter:
----
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 =(