diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php index a3ae42d05aceb1d0e6f369b39548f485813c5c26..bc36c15fc087dbb3ff78237fb0099b77d2daf395 100644 --- a/core/lib/Drupal/Core/DrupalKernel.php +++ b/core/lib/Drupal/Core/DrupalKernel.php @@ -229,9 +229,9 @@ public static function createFromRequest(Request $request, $class_loader, $envir // Initialize our list of trusted HTTP Host headers to protect against // header attacks. - $hostPatterns = Settings::get('trusted_host_patterns', array()); - if (PHP_SAPI !== 'cli' && !empty($hostPatterns)) { - if (static::setupTrustedHosts($request, $hostPatterns) === FALSE) { + $host_patterns = Settings::get('trusted_host_patterns', array()); + 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.'); } } @@ -1270,7 +1270,7 @@ public static function validateHostname(Request $request) { * * @param \Symfony\Component\HttpFoundation\Request $request * The request object. - * @param array $hostPatterns + * @param array $host_patterns * The array of trusted host patterns. * * @return boolean @@ -1278,8 +1278,8 @@ public static function validateHostname(Request $request) { * * @see https://www.drupal.org/node/1992030 */ - protected static function setupTrustedHosts(Request $request, $hostPatterns) { - $request->setTrustedHosts($hostPatterns); + protected static function setupTrustedHosts(Request $request, $host_patterns) { + $request->setTrustedHosts($host_patterns); // Get the host, which will validate the current request. try { diff --git a/sites/example.settings.local.php b/sites/example.settings.local.php index 3d5857a306b356158793eb72e131e983e5ad3aef..7859fe5021951e9a393204ae347e5a690f440f9b 100644 --- a/sites/example.settings.local.php +++ b/sites/example.settings.local.php @@ -55,15 +55,3 @@ * using these parameters in a request to rebuild.php. */ $settings['rebuild_access'] = TRUE; - -/** - * Trust localhost. - * - * This will configure several common hostnames used for local development to - * be trusted hosts. - */ -$settings['trusted_host_patterns'] = array( - '^localhost$', - '^localhost\.*', - '\.local$', -);