RE: [PHP] Unserialize bug?

From: Date: Thu, 22 May 2003 09:36:34 +0000
Subject: RE: [PHP] Unserialize bug?
Groups: php.general 
Request: Send a blank email to php-general+get-148520@lists.php.net to get a copy of this message
> -----Original Message----- > From: Leon Mergen [mailto:lmergen@yahoo.com] > Sent: 22 May 2003 09:47 > > "Jason Wong" <php-general@gremlins.biz> wrote in message > news:200305221257.28872.php-general@gremlins.biz... > > > basketarray : > a:1:{i:23;a:2:{i:0;s:6:\"item14\";i:1;s:6:\"item29\";}} > > Turn on error reporting and you will see that unserialize() > does not like > the > > format of $basketarray. It seems that you have backslashes > in there which > > shouldn't be there. > > That is very strange, though... since that $basketarray is > generated by > serialize() . So the bug is in serialize() ? What are you doing with $basketarray in between serializing and unserializing it? Are you by any chance storing it in a database and retreiving it (and is magic_quotes_runtime On?)? Or passing it between pages as a GET parameter (and is magic_quotes_gpc On?)? In any case, it looks like the serialized value is getting addslashes()-ed, so you need to stripslashes() it before unserialize()-ing it. Cheers! Mike --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: m.ford@lmu.ac.uk Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211

« previous php.general (#148520) next »