From f648185839689cf70fd3fcb254b2ce7313ba6c87 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 5 Jul 2021 17:34:25 +0200 Subject: [PATCH] Fix phpcs --- htdocs/core/lib/security2.lib.php | 4 ++-- test/phpunit/SecurityTest.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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'); } /**