mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
DDC-3120: Warning: Erroneous data format for unserializing PHP5.6+ #3872
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (May 11, 2014).
Originally assigned to: @Ocramius on GitHub.
Jira issue originally created by user techkey:
Hi all,
There seems to be something strange going on in the method
newInstance()of the class\Doctrine\ORM\Mapping\ClassMetadataInfo.The original class method looks like this:
{quote}\Doctrine\ORM\Mapping\ClassMetadataInfo#newInstance(){quote}
What happens now when a class that implements \Serializable is that a "Warning: Erroneous data format for unserializing" shows up and the function unserialize() returns false.
That is because a class that implements \Serializable is expected to have the letter 'C' in the serialize string instead of the letter 'O'.
I've made a quick work-around like this:
{quote}\Doctrine\ORM\Mapping\ClassMetadataInfo#newInstance(){quote}
That seems to work in my isolated tests and with Symfony2 and Doctrine2 and FOSUserBundle together.
I've noticed this because the
Model\Userclass from FOSUserBundle implements\Serializable.I had to implement a check in Model\User class because when using {{'C:%d:"%s":0:{}'}} the $serialized parameter of the
unserializemethod in theModel\Userclass is a empty string then.That warning seems only to happen with PHP5.6+. PHP5.5.12 and below doesn't show that warning.
I hope someone can shine some light on this, thank you,
Cornelis.