newbie symfony gurus Uncategorized

Symfony and serialization

Interesting problem with data unserialization in symfony. So if you have stored serialized value in database and want to unserialize it (lets say it’s $obj->getText() value), you need to make sure you use special chars decode like here:

$value = htmlspecialchars_decode($obj->getText());
$data = unserialize($value);

Without actual htmlspecialchars_decode command PHP compiler will report about offset error.