W3cubDocs

/Drupal 8

public static function 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;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Site!Settings.php/function/Settings::getHashSalt/8.1.x