You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
When using the auto algorithm in the PasswordHasher component outside of a Symfony project, a PHP warning and fatal error is generated:
PHP Notice: Undefined index: hash_algorithm in /symfony/password-hasher/Hasher/PasswordHasherFactory.php on line 119
PHP Fatal error: Uncaught InvalidArgumentException: "class" must be set in {"algorithm":null} in /symfony/password-hasher/Hasher/PasswordHasherFactory.php:86
How to reproduce
Create a simple project: composer init && composer require symfony/password-hasher
Create a PHP file with the following code to exercise the PasswordHasher
<?php
require './vendor/autoload.php';
use Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactory;
$factory = new PasswordHasherFactory(
[
'auto' => ['algorithm' => 'auto'],
]
);
$passwordHasher = $factory->getPasswordHasher('auto');
Possible Solution
Check if $config['hash_algorithm'] is set before adding it to the list of algorithms (and prevent a null being added).
Additional context
N/A
The text was updated successfully, but these errors were encountered:
…lgorithm (matason)
This PR was merged into the 5.3 branch.
Discussion
----------
[PasswordHasher] Prevent PHP fatal error when using auto algorithm
| Q | A
| ------------- | ---
| Branch? | 5.3
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#41571
| License | MIT
| Doc PR | N/A
Fixes a PHP fatal error that occurs when using the auto algorithm of the PasswordHasher in a standalone project.
Commits
-------
dca28a2 [PasswordHasher] Prevent PHP fatal error when using auto algorithm
Symfony version(s) affected: 5.3.x
Description
When using the auto algorithm in the PasswordHasher component outside of a Symfony project, a PHP warning and fatal error is generated:
How to reproduce
Possible Solution
Check if
$config['hash_algorithm']
is set before adding it to the list of algorithms (and prevent a null being added).Additional context
N/A
The text was updated successfully, but these errors were encountered: