Skip to content

Commit

Permalink
restore original logic for libsodium check, but using else/if state…
Browse files Browse the repository at this point in the history
…ments intead of three separate `if` statements
  • Loading branch information
TheDigitalOrchard committed Apr 29, 2024
1 parent 9fef798 commit eb3fdc4
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions lib/framework.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,12 @@

/* check for and load the correct libsodium interface */
if (!defined('LIBSODIUM')) {
if (extension_loaded('libsodium')) {
if (function_exists('\Sodium\crypto_pwhash_str_verify') || function_exists('sodium_crypto_pwhash_str_verify')) {
define('LIBSODIUM', true);
class Hm_Sodium_Compat extends Hm_Sodium_PHP {}
} else {
define('LIBSODIUM', false);
}
if (extension_loaded('libsodium') && function_exists('\Sodium\crypto_pwhash_str_verify')) {
define('LIBSODIUM', true);
class Hm_Sodium_Compat extends Hm_Sodium_PECL {}
} elseif (extension_loaded('sodium') && function_exists('sodium_crypto_pwhash_str_verify')) {
define('LIBSODIUM', true);
class Hm_Sodium_Compat extends Hm_Sodium_PHP {}
} else {
define('LIBSODIUM', false);
}
Expand Down

0 comments on commit eb3fdc4

Please sign in to comment.