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.
This commit is contained in:
Michael Orlitzky 2024-11-04 17:34:49 -05:00 committed by Arnaud Le Blanc
parent 452c5ac989
commit 8a712003aa

View File

@ -39,12 +39,10 @@ $tests = array(
'a short string',
'$5$rounds=123456$asaltof16chars..$gP3VQ/6X7UUEW3HkBn2w1/Ptq2jxPyzV/cZKmF/wJvD'
),
// The "too many rounds" behavior depends on the crypt()
// implementation, but for now everyone agrees on what to do.
8 => array(
'$5$rounds=10$roundstoolow',
'the number of rounds is too low',
'*0'
),
9 => array(
'$5$rounds=1000000000$roundstoohigh',
'the number of rounds is too high',
'*0'