diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index 523b8ccf2cb..4408e2ccd52 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -476,8 +476,8 @@ function getRandomPassword($generic = false, $replaceambiguouschars = null, $len } $generated_password = str_shuffle($randomCode); - } else // Old platform, non cryptographic random - { + } else { + // Old platform, non cryptographic random $max = strlen($lowercase) - 1; for ($x = 0; $x < $nbofchar; $x++) { $tmp = mt_rand(0, $max); diff --git a/test/phpunit/SecurityTest.php b/test/phpunit/SecurityTest.php index d75ec962020..63c52ac60c5 100644 --- a/test/phpunit/SecurityTest.php +++ b/test/phpunit/SecurityTest.php @@ -323,8 +323,8 @@ class SecurityTest extends PHPUnit\Framework\TestCase $this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject lll'); $test="Text with ' encoded with the numeric html entity converted into text entity ' (like when submited by CKEditor)"; - $result=testSqlAndScriptInject($test, 0); - $this->assertGreaterThanOrEqual($expectedresult, $result, 'Error on testSqlAndScriptInject mmm'); + $result=testSqlAndScriptInject($test, 0); // result must be 0 + $this->assertEquals(0, $result, 'Error on testSqlAndScriptInject mmm'); } /**