FOS UserBundle Unable to login

后端 未结 5 687
遇见更好的自我
遇见更好的自我 2020-12-24 03:25

I\'m back with another issue regarding my UserBundle : Everything went perfect while installing and configuring FOS bundle through Symfony2, it even let me create 2 users th

相关标签:
5条回答
  • 2020-12-24 03:47

    This code works for me, YourApplicationName\vendor\doctrine\lib\Doctrine\ORM\Mapping\ClassMetadataInfo.php

    i replace the existing code with the below code

    If ($this->_prototype === null) {
        $this->_prototype = @unserialize(sprintf('O:%d:"%s":0:{}', strlen($this->name), $this->name));
    if ($this->_prototype === false) {
        $this->_prototype = unserialize(sprintf('C:%d:"%s":0:{}', strlen($this->name), $this->name));
    }
    }
    
    0 讨论(0)
  • 2020-12-24 03:52
    1. Check your PHP version by "php -v" on command line. E.g. PHP 5.6.10

    2. Edit the file /vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php::newInstance()

    Add your PHP_VERSION_ID here

    if (PHP_VERSION_ID === 50610 ) {
    .
    }
    

    It's a temporary solution, since we don't edit vendor directory.

    0 讨论(0)
  • 2020-12-24 03:52

    I experienced the same problem with php 5.6.6 (locally with mamp), my workaround was just to go back to 5.4, since that's the version I had running on the Server anyways... but definately something to keep in mind...

    0 讨论(0)
  • 2020-12-24 03:56

    If you are using PHP Version 5.4.29 or 5.5.13

    In: "/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php" find function "newInstance" (around Line 827) and edit as followed until the Fix is merged by doctrine.

    public function newInstance()
    {
        if ($this->_prototype === null) {
            // $this->_prototype = unserialize(sprintf('O:%d:"%s":0:{}', strlen($this->name), $this->name));
            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;
    }
    

    @Benji: thx for the hint: https://github.com/symfony/symfony/issues/11056

    0 讨论(0)
  • 2020-12-24 04:01

    Answering my own question, I found a workaround thanks to this guy :

    http://www.doctrine-project.org/jira/browse/DDC-3120

    He's far better than me when it comes to explaining, but this is what I have now, and it works like a charm! :)

    {
            if ($this->_prototype === null) {
                $this->_prototype = @unserialize(sprintf('O:%d:"%s":0:{}', strlen($this->name), $this->name));
                if ($this->_prototype === false) {
                    $this->_prototype = @unserialize(sprintf('C:%d:"%s":0:{}', strlen($this->name), $this->name));
                }
            }
    
            return clone $this->_prototype;
        }
    
    0 讨论(0)
提交回复
热议问题