Reputation: 1629
I have this code:
$serialized = $_POST['cartSer'];
echo $serialized;
Which prints this:
a:1:{s:15:\"test\";s:3:\"999\";}
I then add this code:
echo unserialize($serialized);
And end up with this error:
Notice: unserialize() [function.unserialize]: Error at offset 5 of 43 bytes in /mypage.php on line 5
What am I doing wrong with the unserialize?
Upvotes: 4
Views: 1515
Reputation: 300825
Sounds like you have magic quotes enabled. Either disable them, or run your value through stripslashes
$serialized = stripslashes($_POST['cartSer']);
Upvotes: 6