note 73296 added to function.unserialize
| From: | IgorDefaye at osu1 dot php dot net | Date: | Fri, 16 Feb 2007 16:08:37 +0000 |
| Subject: | note 73296 added to function.unserialize | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-123486@lists.php.net to get a copy of this message | ||
It took me a good hour to figure out why serialized data stored in mysql database would not
unserialize.
This is what I was trying to unserialize :
a:4:{i:0;s:43:"Date_Format(dateEntree,'%Y%m%d')";}
Addslashes did not work for me, I had to use :
str_replace("'", "\'", $serializedData)
in order to replace only sigle quotes and not double quotes, so I obtained this :
a:4:{i:0;s:43:"Date_Format(dateEntree,\'%Y%m%d\')";}
unserialize does not like single quotes.
Hope it can help someome.
----
Server IP: 69.147.83.197
Probable Submitter: 74.57.245.169
----
Manual Page -- http://www.php.net/manual/en/function.unserialize.php
Edit -- https://master.php.net/note/edit/73296
Del: integrated -- https://master.php.net/note/delete/73296/integrated
Del: useless -- https://master.php.net/note/delete/73296/useless
Del: bad code -- https://master.php.net/note/delete/73296/bad+code
Del: spam -- https://master.php.net/note/delete/73296/spam
Del: non-english -- https://master.php.net/note/delete/73296/non-english
Del: in docs -- https://master.php.net/note/delete/73296/in+docs
Del: other reasons-- https://master.php.net/note/delete/73296
Reject -- https://master.php.net/note/reject/73296
Search -- https://master.php.net/manage/user-notes.php