-1

in UserController I have the following code

$password = $form->get('password'); $encoded = $encoder->encodePassword($user, $password);

It outputs an error $password must be a string. I tried changing value of $password to no effect.

1 Answers1

0

You can convert type of variable in PHP (type juggling).

https://www.php.net/manual/en/language.types.type-juggling.php

So your code will be

$password = (string) $form->get('password');
$encoded = $encoder->encodePassword($user, $password);