diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index eea5fd4..c8e67f8 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -749,10 +749,9 @@ function drupal_valid_test_ua($new_prefix = NULL) { // a test environment. $test_prefix = FALSE; - // Perform a basic check on the Simpletest-user-agent cookie first. If it - // does not exists then perform a basic check on the User-Agent HTTP request - // header. Any inbound request that uses the simpletest UA header needs to be - // validated. + // A valid Simpletest request will contain a hashed and salted authentication + // code. Check if this code is present in a cookie or custom user agent + // string. $http_user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : NULL; $user_agent = isset($_COOKIE['SIMPLETEST_USER_AGENT']) ? $_COOKIE['SIMPLETEST_USER_AGENT'] : $http_user_agent; if (isset($user_agent) && preg_match("/^(simpletest\d+);(.+);(.+);(.+)$/", $user_agent, $matches)) { diff --git a/core/lib/Drupal/Core/Database/Database.php b/core/lib/Drupal/Core/Database/Database.php index 6a24a05..89d3727 100644 --- a/core/lib/Drupal/Core/Database/Database.php +++ b/core/lib/Drupal/Core/Database/Database.php @@ -470,18 +470,14 @@ public static function convertDbUrlToConnectionInfo($url, $root) { 'fragment' => '', ); - // A SQLite database is special because it datebase connection is directly - // to the database file. The variable $info['path'] holds the location of - // the database file. - if ($info['scheme'] === 'sqlite') { - if ($info['path'][0] !== '/') { - $info['path'] = '/' . $info['path']; - } - $info['path'] = $root . $info['path']; - } - elseif ($info['path'][0] === '/') { + // A SQLite database path with two leading slashes indicates a system path. + // Otherwise the path is relative to the Drupal root. + if ($info['path'][0] === '/') { $info['path'] = substr($info['path'], 1); } + if ($info['scheme'] === 'sqlite' && $info['path'][0] !== '/') { + $info['path'] = $root . '/' . $info['path']; + } $database = array( 'driver' => $info['scheme'], diff --git a/core/modules/simpletest/src/BrowserTestBase.php b/core/modules/simpletest/src/BrowserTestBase.php index ac7845f..9702078 100644 --- a/core/modules/simpletest/src/BrowserTestBase.php +++ b/core/modules/simpletest/src/BrowserTestBase.php @@ -153,7 +153,7 @@ protected $sessionName; /** - * The current user logged in using the Mink controled browser. + * The current user logged in using the Mink controlled browser. * * @var bool */ @@ -387,7 +387,7 @@ protected function prepareRequest() { * Retrieves a Drupal path or an absolute path. * * @param string $path - * Drupal path or URL to load into Mink controled browser. + * Drupal path or URL to load into Mink controlled browser. * @param array $options * (optional) Options to be forwarded to the url generator. * @@ -421,7 +421,7 @@ protected function drupalGet($path, array $options = array()) { * Takes a path and returns an absolute path. * * @param string $path - * A path from the Mink controled browser content. + * A path from the Mink controlled browser content. * * @return string * The $path with $base_url prepended, if necessary. @@ -645,7 +645,7 @@ protected function checkPermissions(array $permissions) { } /** - * Logs in a user using the mink controled browser. + * Logs in a user using the mink controlled browser. * * If a user is already logged in, then the current user is logged out before * logging in the specified user. @@ -692,7 +692,7 @@ protected function drupalLogin(AccountInterface $account) { } /** - * Logs a user out of the Mink controled browser and confirms. + * Logs a user out of the Mink controlled browser and confirms. * * Confirms logout by checking the login page. */ @@ -1005,7 +1005,7 @@ protected function installParameters() { * * The generated database table prefix is used for the Drupal installation * being performed for the test. It is also used by the cookie value of - * SIMPLETEST_USER_AGENT by the mink controled browser. During early Drupal + * SIMPLETEST_USER_AGENT by the mink controlled browser. During early Drupal * bootstrap, the cookie is parsed, and if it matches, all database queries * use the database table prefix that has been generated here. * @@ -1185,7 +1185,7 @@ protected function writeSettings(array $settings) { * Rebuilds \Drupal::getContainer(). * * Use this to build a new kernel and service container. For example, when the - * list of enabled modules is changed via the Mink controled browser, in which + * list of enabled modules is changed via the Mink controlled browser, in which * case the test process still contains an old kernel and service container * with an old module list. *