Symfony 3 - 注意:unserialize():偏移量为11个字节的错误

I do not understand, I work under Symfony 3 and I just got an error when I want to go to my user administration page:

Notice: unserialize(): Error at offset 11 of 28 bytes

Symfony\Component\Debug\Exception\ ContextErrorException

in vendor/doctrine/dbal/lib/Doctrine/DBAL/Types/ArrayType.php (line 58)

However, before it worked very well, it's very strange. Several other people have already had the same problem but it is never the same cause.

I remember doing a little emptiness in my useless files of my project but I deleted that which was unused, and the commented blocks which I did not use.

If it helps to solve my problem, here is my user.php

Thanks !

EDIT : Ok I'm just very stupid. My User entity inherits from FOSUserBundle. In my database, I had a User who had the role SUPER_ADMIN. Suaf meanwhile, in my code, I deleted this role to leave only the role ADMIN, and I modified myself in the database by removing the "SUPER" too much. I did not think it would make this kind of bug, if anyone can explain to me why, for my culture.

But in any case the problem is still solved!

This happens because roles are stored as a serialized array, like:

a:1:{i:0;s:16:"ROLE_SUPER_ADMIN";}

See this s:16? This means that during unserialization php will take 16 symbols (which are exactly ROLE_SUPER_ADMIN).

So, when you removed SUPER your data became

a:1:{i:0;s:16:"ROLE_ADMIN";}

and s:16 is incorrect, because now you have 10 symbols instead of 16. But php tries to get 16, which causes error.

This leads us to conclusion that editing raw data is not a good idea.