此前,该应用程序的版本为PHP7.0、SF 3.1和FOS/UserBundle 2.0。
在使用SF 3.4和FOS/UserBundle 2.1迁移到PHP7.2之后,在更改密码期间,我遇到了以下情况:
$ bin/console fos:user:change-password toto pass1234
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'salt' cannot be null" ["exception" => Doctrine\DBAL\Exception\NotNullConstraintViolationException { …},"command" => "fos:user:change-password toto pass1234","message" => """ An exception occurred while executing 'UPDATE fos_user SET salt = ?, password = ? WHERE id = ?' with params [null, "$2y$13$LOb\/************************************wof0QpTGGpzGi", 2]:\n \n SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'salt' cannot be null """] []
In AbstractMySQLDriver.php line 123:
An exception occurred while executing 'UPDATE fos_user SET salt = ?, password = ? WHERE id = ?' with params [null, "$2y$13$LOb\/************************************wof0QpTGGpzGi", 2]:
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'salt' cannot be null
In PDOStatement.php line 144:
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'salt' cannot be null
In PDOStatement.php line 142:
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'salt' cannot be null
fos:user:change-password [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command> <username> <password>发布于 2018-08-23 18:51:22
解决了!
我编辑了文件app/config/security.yml,并将security.encoders.FOS\UserBundle\Model\UserInterface的值(即bcrypt)替换为argon2i。
然后我清除了缓存,重试了一次,这起作用了!
https://symfony.com/doc/current/reference/configuration/security.html#reference-security-argon2i
https://stackoverflow.com/questions/51984009
复制相似问题