Merge pull request #22736 from hregis/fix_option_passing_null_is_deprecated

FIX passing null in "$options" parameter is deprecated
This commit is contained in:
Laurent Destailleur 2022-11-02 17:04:44 +01:00 committed by GitHub
commit 556a0e5429
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -146,7 +146,7 @@ function dolEncrypt($chain, $key = '', $ciphering = "AES-256-CTR")
} }
$ivseed = dolGetRandomBytes($ivlen); $ivseed = dolGetRandomBytes($ivlen);
$newchain = openssl_encrypt($chain, $ciphering, $key, null, $ivseed); $newchain = openssl_encrypt($chain, $ciphering, $key, 0, $ivseed);
return 'dolcrypt:'.$ciphering.':'.$ivseed.':'.$newchain; return 'dolcrypt:'.$ciphering.':'.$ivseed.':'.$newchain;
} else { } else {
return $chain; return $chain;
@ -180,9 +180,9 @@ function dolDecrypt($chain, $key = '')
if (function_exists('openssl_decrypt')) { if (function_exists('openssl_decrypt')) {
$tmpexplode = explode(':', $reg[2]); $tmpexplode = explode(':', $reg[2]);
if (!empty($tmpexplode[1]) && is_string($tmpexplode[0])) { if (!empty($tmpexplode[1]) && is_string($tmpexplode[0])) {
$newchain = openssl_decrypt($tmpexplode[1], $ciphering, $key, null, $tmpexplode[0]); $newchain = openssl_decrypt($tmpexplode[1], $ciphering, $key, 0, $tmpexplode[0]);
} else { } else {
$newchain = openssl_decrypt($tmpexplode[0], $ciphering, $key, null, null); $newchain = openssl_decrypt($tmpexplode[0], $ciphering, $key, 0, null);
} }
} else { } else {
$newchain = 'Error function openssl_decrypt() not available'; $newchain = 'Error function openssl_decrypt() not available';