Skip to content
This repository has been archived by the owner on Jul 17, 2024. It is now read-only.

Commit

Permalink
do not throw deprecation messages on PHP 8.1
Browse files Browse the repository at this point in the history
Signed-off-by: Dennis Riehle <[email protected]>
  • Loading branch information
driehle committed Nov 23, 2021
1 parent 78bd5a5 commit b459393
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 16 deletions.
4 changes: 0 additions & 4 deletions src/Key/Derivation/SaltedS2k.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 0 additions & 12 deletions test/Key/Derivation/SaltedS2kTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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',
Expand All @@ -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);
Expand Down

0 comments on commit b459393

Please sign in to comment.