diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php index fd591d6..12bdeed 100644 --- a/core/lib/Drupal/Core/DrupalKernel.php +++ b/core/lib/Drupal/Core/DrupalKernel.php @@ -221,7 +221,7 @@ public static function createFromRequest(Request $request, $class_loader, $envir Settings::initialize(dirname($core_root), $site_path, $class_loader); // Initialize our list of trusted HTTP Host headers to protect against - // header attacks + // header attacks. $hostPatterns = Settings::get('trusted_host_patterns', array()); if (PHP_SAPI !== 'cli' && !empty($hostPatterns)) { if (static::setupTrustedHosts($request, $hostPatterns) === FALSE) { @@ -313,7 +313,7 @@ public function __construct($environment, $class_loader, $allow_dumping = TRUE) */ public static function findSitePath(Request $request, $require_settings = TRUE) { if (static::validateHostname($request) === FALSE) { - throw new BadRequestHttpException(''); + throw new BadRequestHttpException(); } // Check for a simpletest override. @@ -1286,12 +1286,12 @@ public static function validateHostname(Request $request) { * @endcode * * @param \Symfony\Component\HttpFoundation\Request $request - * The request object + * The request object. * @param array $hostPatterns - * The array of trusted host patterns + * The array of trusted host patterns. * * @return boolean - * TRUE if the Host header is trusted, FALSE otherwise + * TRUE if the Host header is trusted, FALSE otherwise. * * @see https://www.drupal.org/node/1992030 */ diff --git a/core/modules/system/src/Tests/System/TrustedHostsTest.php b/core/modules/system/src/Tests/System/TrustedHostsTest.php index 02764ce..2be2c8b 100644 --- a/core/modules/system/src/Tests/System/TrustedHostsTest.php +++ b/core/modules/system/src/Tests/System/TrustedHostsTest.php @@ -42,7 +42,7 @@ public function testStatusPageWithoutConfiguration() { } /** - * Tests that the status page shows the trusted patterns from settings.php + * Tests that the status page shows the trusted patterns from settings.php. */ public function testStatusPageWithConfiguration() { $settings['settings']['trusted_host_patterns'] = (object) array( diff --git a/core/modules/system/system.install b/core/modules/system/system.install index dced956..4a8683e 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -612,8 +612,8 @@ function system_requirements($phase) { } } - // See if trusted hostnames have been configured, and warn the user if not - // set. + // See if trusted hostnames have been configured, and warn the user if they + // are not set. if ($phase == 'runtime') { $trusted_host_patterns = Settings::get('trusted_host_patterns'); if (empty($trusted_host_patterns)) { diff --git a/core/modules/views_ui/src/ViewUI.php b/core/modules/views_ui/src/ViewUI.php index 93acf19..e8464fa 100644 --- a/core/modules/views_ui/src/ViewUI.php +++ b/core/modules/views_ui/src/ViewUI.php @@ -612,7 +612,7 @@ public function renderPreview($display_id, $args = array()) { // Make view links come back to preview. // Also override the current path so we get the pager, and make sure the - // Request object gets all of proper values from $_SERVER. + // Request object gets all of the proper values from $_SERVER. $request = Request::createFromGlobals(); $request->attributes->set(RouteObjectInterface::ROUTE_NAME, 'entity.view.preview_form'); $request->attributes->set(RouteObjectInterface::ROUTE_OBJECT, \Drupal::service('router.route_provider')->getRouteByName('entity.view.preview_form')); diff --git a/core/tests/Drupal/Tests/Core/DrupalKernel/DrupalKernelTrustedHostsTest.php b/core/tests/Drupal/Tests/Core/DrupalKernel/DrupalKernelTrustedHostsTest.php index 150a724..53a0305 100644 --- a/core/tests/Drupal/Tests/Core/DrupalKernel/DrupalKernelTrustedHostsTest.php +++ b/core/tests/Drupal/Tests/Core/DrupalKernel/DrupalKernelTrustedHostsTest.php @@ -56,11 +56,11 @@ public function testTrustedHosts($host, $server_name, $message, $expected = FALS public function providerTestTrustedHosts() { $data = []; - // Tests canonical URL + // Tests canonical URL. $data[] = ['www.example.com', 'www.example.com', 'canonical URL is trusted', TRUE]; // Tests missing hostname for HTTP/1.0 compatability where the Host - // header is optional + // header is optional. $data[] = [NULL, 'www.example.com', 'empty Host is valid', TRUE]; // Tests the additional paterns from the settings. @@ -69,7 +69,7 @@ public function providerTestTrustedHosts() { $data[] = ['www.example.org', 'www.example.com', 'host from settings is trusted', TRUE]; $data[] = ['example.org', 'www.example.com', 'host from settings is trusted', TRUE]; - // Tests mismatches + // Tests mismatch. $data[] = ['www.blackhat.com', 'www.example.com', 'unspecified host is untrusted', FALSE]; return $data; diff --git a/sites/default/default.settings.php b/sites/default/default.settings.php index 7acad5a..7cc10be 100644 --- a/sites/default/default.settings.php +++ b/sites/default/default.settings.php @@ -616,8 +616,8 @@ * * To enable the trusted host mechanism, you enable your allowable hosts * in $settings['trusted_host_patterns']. This should be an array of regular - * expression paterns, without delimiters, representing the hosts you would like - * to allow. + * expression patterns, without delimiters, representing the hosts you would + * like to allow. * * For example: * @code