Skip to content

Commit 40faae6

Browse files
committed
ext/standard/tests/strings/crypt_sha256.phpt: fix on musl
Among other things, this test tries to run too few and too many rounds of SHA256. In both cases, it is expecting an error, but that behavior depends on the implementation: * PHP's own implementation raises an error in either case * libxcrypt raises an error in either case * Older versions of glibc would clamp the number of rounds to a valid amount (newer versions don't have libcrypt) * Musl libc clamps values that are too low, but raises an error for values that are too high If PHP is built with --with-external-libcrypt, the musl implementation above can be used. Even if libxcrypt is installed, PHP will notice that no additional -lfoo flags are needed to use the crypt implementation in musl. To pass on such a system, we must not test for the "too few rounds" behavior.
1 parent dbcdd4e commit 40faae6

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

ext/standard/tests/strings/crypt_sha256.phpt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,10 @@ $tests = array(
3939
'a short string',
4040
'$5$rounds=123456$asaltof16chars..$gP3VQ/6X7UUEW3HkBn2w1/Ptq2jxPyzV/cZKmF/wJvD'
4141
),
42+
43+
// The "too many rounds" behavior depends on the crypt()
44+
// implementation, but for now everyone agrees on what to do.
4245
8 => array(
43-
'$5$rounds=10$roundstoolow',
44-
'the number of rounds is too low',
45-
'*0'
46-
),
47-
9 => array(
4846
'$5$rounds=1000000000$roundstoohigh',
4947
'the number of rounds is too high',
5048
'*0'

0 commit comments

Comments
 (0)