4.3.7 array serialize problem
| From: | pf at sistemasdinamicos dot com dot ar | Date: | Sun, 26 Dec 2004 08:41:36 +0000 |
| Subject: | 4.3.7 array serialize problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-205178@lists.php.net to get a copy of this message | ||
Hi!
Have PHP 4.3.7, magic_quotes_gpc = On
Have a multidimensional array made from values from a POST form.
It addslashes() every field of the form as expected, like (') => (\'),
etc.
When I searialize the array to put it into a mysql db it seems to fail
to describe the string lenght of values with the (') character, like
this:
$arr['PestName']="a'cqua", it results the following in the serialized
string stored in the db:
a:1:{i:1;a:5:{s:8:"PestName";s:7:"a'cqua"....
note that "a'cqua" is not 7 chars lenght, but 6.
The problem is when I try to recover the array with unserialize(), it
fails, returning false. It is obvious that php is counting the (\)
character when serializing the string, but it stores it without it in
the db, so when it tries to recover the array, it fails.
Is this a known bug? Are there any workarounds you know?
Thanks a lot in advance.
Hernan