Merge branch '4.4'

* 4.4:
  [Security] minor improvement
  fix merge
This commit is contained in:
Nicolas Grekas 2019-06-13 16:09:44 +02:00
commit 0bb0335ab6
2 changed files with 8 additions and 4 deletions

View File

@ -30,17 +30,17 @@ class ClassExistsMock
public static function class_exists($name, $autoload = true) public static function class_exists($name, $autoload = true)
{ {
return (bool) (self::$classes[ltrim($name, '\\')] ?? class_exists($name, $autoload)); return (bool) (self::$classes[ltrim($name, '\\')] ?? \class_exists($name, $autoload));
} }
public static function interface_exists($name, $autoload = true) public static function interface_exists($name, $autoload = true)
{ {
return (bool) (self::$classes[ltrim($name, '\\')] ?? interface_exists($name, $autoload)); return (bool) (self::$classes[ltrim($name, '\\')] ?? \interface_exists($name, $autoload));
} }
public static function trait_exists($name, $autoload = true) public static function trait_exists($name, $autoload = true)
{ {
return (bool) (self::$classes[ltrim($name, '\\')] ?? trait_exists($name, $autoload)); return (bool) (self::$classes[ltrim($name, '\\')] ?? \trait_exists($name, $autoload));
} }
public static function register($class) public static function register($class)

View File

@ -48,11 +48,15 @@ final class SodiumPasswordEncoder implements PasswordEncoderInterface, SelfSalti
public static function isSupported(): bool public static function isSupported(): bool
{ {
if (\extension_loaded('libsodium') || \function_exists('sodium_crypto_pwhash_str')) {
return true;
}
if (class_exists('ParagonIE_Sodium_Compat') && method_exists('ParagonIE_Sodium_Compat', 'crypto_pwhash_is_available')) { if (class_exists('ParagonIE_Sodium_Compat') && method_exists('ParagonIE_Sodium_Compat', 'crypto_pwhash_is_available')) {
return \ParagonIE_Sodium_Compat::crypto_pwhash_is_available(); return \ParagonIE_Sodium_Compat::crypto_pwhash_is_available();
} }
return \function_exists('sodium_crypto_pwhash_str') || \extension_loaded('libsodium'); return false;
} }
/** /**