From b459393115da07a2bcea9355b85c4648d87ac24c Mon Sep 17 00:00:00 2001 From: Dennis Riehle Date: Tue, 23 Nov 2021 11:08:07 +0100 Subject: [PATCH] do not throw deprecation messages on PHP 8.1 Signed-off-by: Dennis Riehle --- src/Key/Derivation/SaltedS2k.php | 4 ---- test/Key/Derivation/SaltedS2kTest.php | 12 ------------ 2 files changed, 16 deletions(-) diff --git a/src/Key/Derivation/SaltedS2k.php b/src/Key/Derivation/SaltedS2k.php index b8aa57e..0d1a8fa 100644 --- a/src/Key/Derivation/SaltedS2k.php +++ b/src/Key/Derivation/SaltedS2k.php @@ -72,10 +72,6 @@ public static function calc($hash, $password, $salt, $bytes) throw new Exception\InvalidArgumentException('The salt size must be at least of 8 bytes'); } - if (PHP_VERSION_ID >= 80100) { - trigger_error('Function mhash_keygen_s2k() is deprecated starting with PHP 8.1', E_USER_DEPRECATED); - } - $result = ''; foreach (range(0, ceil($bytes / strlen(hash($hash, '', true))) - 1) as $i) diff --git a/test/Key/Derivation/SaltedS2kTest.php b/test/Key/Derivation/SaltedS2kTest.php index e856d4c..c7d6a0f 100644 --- a/test/Key/Derivation/SaltedS2kTest.php +++ b/test/Key/Derivation/SaltedS2kTest.php @@ -32,10 +32,6 @@ public function testCalc() return; } - if (PHP_VERSION_ID >= 80100) { - $this->expectDeprecation(); - } - $password = SaltedS2k::calc('sha256', 'test', $this->salt, 32); $this->assertEquals(32, strlen($password)); $this->assertEquals('qzQISUBUSP1iqYtwe/druhdOVqluc/Y2TetdSHSbaw8=', base64_encode($password)); @@ -48,10 +44,6 @@ public function testCalcWithWrongHash() return; } - if (PHP_VERSION_ID >= 80100) { - $this->expectDeprecation(); - } - $this->expectException(Exception\InvalidArgumentException::class); $this->expectExceptionMessage(sprintf( 'The hash algorithm wrong is not supported by %s', @@ -67,10 +59,6 @@ public function testCalcWithWrongSalt() return; } - if (PHP_VERSION_ID >= 80100) { - $this->expectDeprecation(); - } - $this->expectException(Exception\InvalidArgumentException::class); $this->expectExceptionMessage('The salt size must be at least of 8 bytes'); SaltedS2k::calc('sha256', 'test', substr($this->salt, -1), 32);