Skip to content
This repository was archived by the owner on Dec 15, 2019. It is now read-only.
This repository was archived by the owner on Dec 15, 2019. It is now read-only.

erreur : Warning: Erroneous data format for unserializing 'Ben\UserBundle\Entity\User'  #2

@abel406

Description

@abel406

Hi benaich,
Congratulations for this app. It's been very helpful for me on my early beginnings with symfony.
After having downloaded the master and having done all the read me file recommendations i had the following issue on doctrine:

erreur : Warning: Erroneous data format for unserializing 'Ben\UserBundle\Entity\User' in C:\wamp64\www\doctors\vendor\doctrine\orm\lib\Doctrine\ORM\Mapping\ClassMetadataInfo.php line 872

I read this post DDC-3120: Warning: from @doctrinebot and chancging doctrine line to this:

"doctrine/orm": "~2.4.6,>=2.2.3,<2.5",

I went to the ClassMetadataInfo.php and changed the following lines starting at 866 line:

public function newInstance()
    {
        if ($this->_prototype === null) {
            if (PHP_VERSION_ID === 50429 || PHP_VERSION_ID === 50513) {
                $this->_prototype = $this->reflClass->newInstanceWithoutConstructor();
            } else {
                $this->_prototype = unserialize(sprintf('O:%d:"%s":0:{}', strlen($this->name), $this->name));
            }
        }
        return clone $this->_prototype;
    }

to this

public function newInstance()
    {
        if ($this->_prototype === null) {
           if (PHP_VERSION_ID >= 50513 || PHP_VERSION_ID === 50429 || PHP_VERSION_ID === 50513) {
                $this->_prototype = $this->reflClass->newInstanceWithoutConstructor();
            } else {
                $this->_prototype = unserialize(sprintf('O:%d:"%s":0:{}', strlen($this->name), $this->name));
            }
        }
        return clone $this->_prototype;
    }

and it worked. So i think it is a good addition to this repo.

I hope this helps other.

Regards from Cuba.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions