8000 Sending ProfileFormType emits warning · Issue #2549 · FriendsOfSymfony/FOSUserBundle · GitHub
[go: up one dir, main page]

Skip to content

Sending ProfileFormType emits warning #2549

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
nenadalm opened this issue Apr 26, 2017 · 1 comment
Closed

Sending ProfileFormType emits warning #2549

nenadalm opened this issue Apr 26, 2017 · 1 comment

Comments

@nenadalm
Copy link

Symfony FOSUserBundle versions: 2.0.0, master

Description of the problem including expected versus actual behavior:
Submitting forms with empty confirmation password emits warning on this line: https://github.com/symfony/symfony/blob/8701cae777d77b182e120877332a0a050afb2bd5/src/Symfony/Component/Security/Core/Encoder/BasePasswordEncoder.php#L84 (https://secure.php.net/manual/en/function.hash-equals.php) because passed password is null instead of string. That happens because of UserPassword constraint, which expects value to be string (

'constraints' => new UserPassword($constraintsOptions),
). That is solvable by using 'empty_data' => '' option on the password field since Symfony 3.1 (symfony/symfony#5906 (comment))

So to sum up: fields using UserPassword constraint should set 'empty_data' => '' option to prevent php warning (which is converted into exception in our dev env).

Steps to reproduce:

  1. Submit ProfileFormType with empty current_password field (https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Tests/Form/Type/ProfileFormTypeTest.php#L29)

Provide logs (if relevant):
Warning: hash_equals(): Expected user_string to be a string, null given

should I send pr with the empty_data option set? (on symfony <3.1 behaviour will stay the same and >=3.1 won't emit the warning.)

@XWB
Copy link
Member
XWB commented Nov 29, 2017

The NotBlank constraint was added in a previous release.

@XWB XWB closed this as completed Nov 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0