Skip to content
Snippets Groups Projects
Commit eeeb5ffb authored by Eric POMMATEAU's avatar Eric POMMATEAU
Browse files

Merge branch 'fix' into 'master'

fix string returned instead of float

See merge request libriciel/direction-du-developpement/bibliotheque/php-password!2
parents 324c3869 54d029ba
No related branches found
No related tags found
No related merge requests found
Pipeline #41569 failed
......@@ -24,6 +24,9 @@ build:
- docker login -u "gitlab-ci-token" -p "$CI_JOB_TOKEN" $CI_REGISTRY
- docker push ${CONTAINER_IMAGE}
security_scan:
allow_failure: true
.tests:
stage: test
image: "$CONTAINER_IMAGE"
......
# 3.0.1 - 2023-02-15
- Fix PasswordStrengthMeterAnssi::entropy() qui renvoyait un string à la place d'un float
# 3.0.0 - 2022-02-24
## Evolution
......@@ -6,7 +10,7 @@
## Suppression
- Retrait de la commande symfony de génération de mot de passe (non utilisatble dans le programme qui importe la lib)
- Retrait de la commande symfony de génération de mot de passe (non utilisable dans le programme qui importe la lib)
# 2.0.1 - 2021-12-29
......
<?php
declare(strict_types=1);
namespace Libriciel\Password\Service;
/**
......@@ -78,7 +80,7 @@ class PasswordStrengthMeterAnssi implements PasswordStrengthMeterInterface
$length = mb_strlen($string);
$symbols = $this->symbols($string);
$value = $length * log($symbols, 2);
return sprintf("%.{$precision}f", $value);
return round($value, $precision);
}
/**
......
<?php
declare(strict_types=1);
namespace LibricielTest\Password\Service;
use Libriciel\Password\Service\PasswordStrengthMeterAnssi;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment