Settings::getHashSalt

public static Settings::getHashSalt()

Gets a salt useful for hardening against SQL injection.

Return value

string A salt based on information in settings.php, not in the database.

Throws

\RuntimeException

File

core/lib/Drupal/Core/Site/Settings.php, line 134

Class

Settings
Read only settings that are initialized with the class.

Namespace

Drupal\Core\Site

Code

public static function getHashSalt() {
  $hash_salt = self::$instance->get('hash_salt');
  // This should never happen, as it breaks user logins and many other
  // services. Therefore, explicitly notify the user (developer) by throwing
  // an exception.
  if (empty($hash_salt)) {
    throw new \RuntimeException('Missing $settings[\'hash_salt\'] in settings.php.');
  }

  return $hash_salt;
}
doc_Drupal
2016-10-29 09:42:13
Comments
Leave a Comment

Please login to continue.