Commit b6553856 authored by Dries's avatar Dries
Browse files

- Patch #276008 by lilou, Arancaytar: missing user agent should not trigger a...

- Patch #276008 by lilou, Arancaytar: missing user agent should not trigger a notice per the HTTP specification.
parent 1a089351
......@@ -1358,7 +1358,7 @@ final protected static function openConnection($key, $target) {
// We need to pass around the simpletest database prefix in the request
// and we put that in the user_agent header.
if (preg_match("/^simpletest\d+$/", $_SERVER['HTTP_USER_AGENT'])) {
if (isset($_SERVER['HTTP_USER_AGENT']) && preg_match("/^simpletest\d+$/", $_SERVER['HTTP_USER_AGENT'])) {
$db_prefix .= $_SERVER['HTTP_USER_AGENT'];
}
return $new_connection;
......
......@@ -260,7 +260,7 @@ class SimpleTestFunctionalTest extends DrupalWebTestCase {
* @return The test is being run from inside a CURL request.
*/
function inCURL() {
return preg_match("/^simpletest\d+/", $_SERVER['HTTP_USER_AGENT']);
return isset($_SERVER['HTTP_USER_AGENT']) && preg_match("/^simpletest\d+/", $_SERVER['HTTP_USER_AGENT']);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment