Skip to content

NativeEncoder::needsRehash passes string as 2nd argument to password_needs_rehash; this has to be an int #36451

@olia-bn

Description

@olia-bn

Symfony version(s) affected: 4.4.7, others

Description
Symfony\Component\Security\Core\Encoder\NativePasswordEncoder::needsRehash is calling PHP native function password_needs_rehash with 2nd argument (algorithm) being string while it needs to be an int.

https://github.com/symfony/security-core/blob/7b409f4f186728081f37e9e788c1617dd2b6d702/Encoder/NativePasswordEncoder.php#L108

Same issue will affect NativePasswordEncoder::encodePassword function
https://github.com/symfony/security-core/blob/7b409f4f186728081f37e9e788c1617dd2b6d702/Encoder/NativePasswordEncoder.php#L71

How to reproduce
No special set up required; algorithm variable of the NativePasswordEncoder is a string and it's directly passed into password_needs_rehash

Possible Solution
Cast the variable to string before passing ?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions