Package: symfony / 5.4.23+dfsg-1+deb12u4

skip-test-assertions-that-are-no-longer-valid-with-PHP-8..patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
From: Christian Flothmann <christian.flothmann@qossmic.com>
Date: Sat, 13 Apr 2024 09:04:03 +0200
Subject: skip test assertions that are no longer valid with PHP >=
 8.2.18/8.3.5

Origin: upstream, https://github.com/symfony/symfony/commit/210e9e49089d065e2e2f3f4ee90c75155e94ac86
---
 .../PasswordHasher/Tests/Hasher/NativePasswordHasherTest.php        | 6 +++++-
 .../PasswordHasher/Tests/Hasher/SodiumPasswordHasherTest.php        | 6 +++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/Symfony/Component/PasswordHasher/Tests/Hasher/NativePasswordHasherTest.php b/src/Symfony/Component/PasswordHasher/Tests/Hasher/NativePasswordHasherTest.php
index 5dc3019..4cf708b 100644
--- a/src/Symfony/Component/PasswordHasher/Tests/Hasher/NativePasswordHasherTest.php
+++ b/src/Symfony/Component/PasswordHasher/Tests/Hasher/NativePasswordHasherTest.php
@@ -103,7 +103,11 @@ class NativePasswordHasherTest extends TestCase
         $hasher = new NativePasswordHasher(null, null, 4, \PASSWORD_BCRYPT);
         $plainPassword = "a\0b";
 
-        $this->assertFalse($hasher->verify(password_hash($plainPassword, \PASSWORD_BCRYPT, ['cost' => 4]), $plainPassword));
+        if (\PHP_VERSION_ID < 80218 || \PHP_VERSION_ID >= 80300 && \PHP_VERSION_ID < 80305) {
+            // password_hash() does not accept passwords containing NUL bytes since PHP 8.2.18 and 8.3.5
+            $this->assertFalse($hasher->verify(password_hash($plainPassword, \PASSWORD_BCRYPT, ['cost' => 4]), $plainPassword));
+        }
+
         $this->assertTrue($hasher->verify($hasher->hash($plainPassword), $plainPassword));
     }
 
diff --git a/src/Symfony/Component/PasswordHasher/Tests/Hasher/SodiumPasswordHasherTest.php b/src/Symfony/Component/PasswordHasher/Tests/Hasher/SodiumPasswordHasherTest.php
index 3dc97c7..101c09f 100644
--- a/src/Symfony/Component/PasswordHasher/Tests/Hasher/SodiumPasswordHasherTest.php
+++ b/src/Symfony/Component/PasswordHasher/Tests/Hasher/SodiumPasswordHasherTest.php
@@ -78,7 +78,11 @@ class SodiumPasswordHasherTest extends TestCase
         $hasher = new SodiumPasswordHasher(null, null);
         $plainPassword = "a\0b";
 
-        $this->assertFalse($hasher->verify(password_hash($plainPassword, \PASSWORD_BCRYPT, ['cost' => 4]), $plainPassword));
+        if (\PHP_VERSION_ID < 80218 || \PHP_VERSION_ID >= 80300 && \PHP_VERSION_ID < 80305) {
+            // password_hash() does not accept passwords containing NUL bytes since PHP 8.2.18 and 8.3.5
+            $this->assertFalse($hasher->verify(password_hash($plainPassword, \PASSWORD_BCRYPT, ['cost' => 4]), $plainPassword));
+        }
+
         $this->assertTrue($hasher->verify((new NativePasswordHasher(null, null, 4, \PASSWORD_BCRYPT))->hash($plainPassword), $plainPassword));
     }