protected function DrupalKernel::initializeSettings in Drupal 9
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/DrupalKernel.php \Drupal\Core\DrupalKernel::initializeSettings()
Locate site path and initialize settings singleton.
Parameters
\Symfony\Component\HttpFoundation\Request $request: The current request.
Throws
\Symfony\Component\HttpKernel\Exception\BadRequestHttpException In case the host name in the request is not trusted.
2 calls to DrupalKernel::initializeSettings()
- DrupalKernel::handle in core/
lib/ Drupal/ Core/ DrupalKernel.php - UpdateKernel::handle in core/
lib/ Drupal/ Core/ Update/ UpdateKernel.php
File
- core/
lib/ Drupal/ Core/ DrupalKernel.php, line 1061
Class
- DrupalKernel
- The DrupalKernel class is the core of Drupal itself.
Namespace
Drupal\CoreCode
protected function initializeSettings(Request $request) {
$site_path = static::findSitePath($request);
$this
->setSitePath($site_path);
Settings::initialize($this->root, $site_path, $this->classLoader);
// Initialize our list of trusted HTTP Host headers to protect against
// header attacks.
$host_patterns = Settings::get('trusted_host_patterns', []);
if (PHP_SAPI !== 'cli' && !empty($host_patterns)) {
if (static::setupTrustedHosts($request, $host_patterns) === FALSE) {
throw new BadRequestHttpException('The provided host name is not valid for this server.');
}
}
}