diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index 895409d..25e9b9a 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -2484,7 +2484,8 @@ function drupal_valid_test_ua($new_prefix = NULL) { // The file properties add more entropy not easily accessible to others. $key = drupal_get_hash_salt() . filectime(__FILE__) . fileinode(__FILE__); $time_diff = REQUEST_TIME - $time; - // We cant use Crypt::hmacBase64() yet. + // We cant use Crypt::hmacBase64() yet because this can be called in very + // early bootstrap when autoloader has not been initialized yet. $test_hmac = base64_encode(hash_hmac('sha256', $check_string, $key, TRUE)); $test_hmac = strtr($test_hmac, array('+' => '-', '/' => '_', '=' => '')); // Since we are making a local request a 5 second time window is allowed, diff --git a/core/lib/Drupal/Component/Utility/Crypt.php b/core/lib/Drupal/Component/Utility/Crypt.php index d1e8db6..9fec8b5 100644 --- a/core/lib/Drupal/Component/Utility/Crypt.php +++ b/core/lib/Drupal/Component/Utility/Crypt.php @@ -74,12 +74,12 @@ public static function randomBytes($count) { /** * Calculates a base-64 encoded, URL-safe sha-256 hmac. * - * @param $data + * @param string $data * String to be validated with the hmac. - * @param $key + * @param string $key * A secret string key. * - * @return + * @return string * A base-64 encoded sha-256 hmac, with + replaced with -, / with _ and * any = padding characters removed. */ @@ -92,10 +92,10 @@ public static function hmacBase64($data, $key) { /** * Calculates a base-64 encoded, URL-safe sha-256 hash. * - * @param $data + * @param string $data * String to be hashed. * - * @return + * @return string * A base-64 encoded sha-256 hash, with + replaced with -, / with _ and * any = padding characters removed. */ @@ -106,12 +106,12 @@ public static function hashBase64($data) { } /** - * Genearates a random, base-64 encoded, URL-safe, sha-256 hashed string. + * Generates a random, base-64 encoded, URL-safe, sha-256 hashed string. * * @param int $count * The number of characters (bytes) of the string to be hashed. * - * @return + * @return string * A base-64 encoded sha-256 hash, with + replaced with -, / with _ and * any = padding characters removed. * @@ -119,7 +119,7 @@ public static function hashBase64($data) { * @see \Drupal\Component\Utility\Crypt::hashBase64() */ public static function randomStringHashed($count) { - return self::hashBase64(self::randomBytes($count)); + return static::hashBase64(static::randomBytes($count)); } }