Skip to content

Commit 93fcdb8

Browse files
[PasswordHasher] Skip test on nul byte for PHP versions that doesn't support it with Bcrypt
1 parent fbc47bc commit 93fcdb8

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/Symfony/Component/PasswordHasher/Tests/Hasher/NativePasswordHasherTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,13 @@ public function testBcryptWithLongPassword()
9898
$this->assertTrue($hasher->verify($hasher->hash($plainPassword), $plainPassword));
9999
}
100100

101+
/**
102+
* "password_hash()" does not accept passwords containing NUL bytes prior to PHP 8.2
103+
* and throws a ValueError, thus this test is skipped because `$hasher->verify()` will
104+
* not be executed.
105+
*
106+
* @requires PHP >= 8.2
107+
*/
101108
public function testBcryptWithNulByte()
102109
{
103110
$hasher = new NativePasswordHasher(null, null, 4, \PASSWORD_BCRYPT);

src/Symfony/Component/PasswordHasher/Tests/Hasher/SodiumPasswordHasherTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,13 @@ public function testBcryptWithLongPassword()
7373
$this->assertTrue($hasher->verify((new NativePasswordHasher(null, null, 4, \PASSWORD_BCRYPT))->hash($plainPassword), $plainPassword));
7474
}
7575

76+
/**
77+
* "password_hash()" does not accept passwords containing NUL bytes prior to PHP 8.2
78+
* and throws a ValueError, thus this test is skipped because `$hasher->verify()` will
79+
* not be executed.
80+
*
81+
* @requires PHP >= 8.2
82+
*/
7683
public function testBcryptWithNulByte()
7784
{
7885
$hasher = new SodiumPasswordHasher(null, null);

0 commit comments

Comments
 (0)