i am using friendsofsymfony bundle for authentication, the scenario is when i try to login, the user logged in successfully and getting access token, but in same request when some security events triggered and try to update lastLogin column in user table i am getting above error.
this error came out after upgrading symfony from 4.3 to 5.4
scurity file:
security:
password_hashers:
FOSUserBundleModelUserInterface:
algorithm: auto
cost: 13
providers:
fos_userbundle:
id: fos_user.user_provider.username
firewalls:
main:
pattern: ^/
user_checker: security.user_checker
form_login:
provider: fos_userbundle
csrf_token_generator: security.csrf.token_manager
logout: true
anonymous: true
remember_me:
secret: '%kernel.secret%'
lifetime: 604800 # 1 week in seconds
path: /
access_control:
- { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: '%env(X-FORWARDED-PROTO)' }
......
imports:
- { resource: 'role_hierarchy.yaml' }
composer.json packages that I have installed:
"doctrine/doctrine-bundle": "2.7.2",
"doctrine/doctrine-migrations-bundle": "3.2.4",
"doctrine/orm": "2.15.3",
"friendsofsymfony/user-bundle": "3.2.1",
2
Answers
Solution in my case: In User Entity the properties must be same with FOS UserInterface, so i solved it by checking common properties (username,email,password and ..etc) make them exactly same.
maybe you have two choice :
1. you are trying to insert/update row in database but username sent without value, try to dump username variable and check the value
2. change security bundle, from FOSUserBundle to SecurityBundle (in 5.4 version)