Help, can anyone come across already ... here is a test project trying to handle authentication and authorization with the storage of users and roles in the database, and in response to PHP 5.4 we get an error:

Fatal error: Call to undefined method Acme\BlogBundle\Entity\User::getRole() in R:\www\Learn-Symfony\vendor\symfony\symfony\src\Symfony\Component\Security\Core\Role\RoleHierarchy.php on line 47 

And on PHP 5.3, everything is perfectly smooth.

To install the test data you need to run
php app/console doctrine:fixtures:load

Then we try to enter the /admin/ login / password john.doe/admin : john.doe/admin

    1 answer 1

    In general, the casket just opened :)

    The problem seems to be that within the model, roles are stored as an ArrayCollection , but the getRoles() method should return a regular array since ArrayCollection itself probably does not serialize at all :( and for some reason the old code worked in 5.3 I don’t catch it :)