diff options
author | Dries Buytaert <dries@buytaert.net> | 2009-07-04 14:49:31 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2009-07-04 14:49:31 +0000 |
commit | 2e0a4d26af0d47b177fd855ba5dfc1d8c50aa929 (patch) | |
tree | 1f89d1043ad0cabeb4185a1327c7827d03df4d61 /includes | |
parent | d51625c304000f5ec1d5c6c3cf06e9e58be93a25 (diff) | |
download | brdo-2e0a4d26af0d47b177fd855ba5dfc1d8c50aa929.tar.gz brdo-2e0a4d26af0d47b177fd855ba5dfc1d8c50aa929.tar.bz2 |
- Patch #482646 by Dave Reid et al: check for existence of ['HTTP_USER_AGENT'] for the SimpleTest user agent.
Diffstat (limited to 'includes')
-rw-r--r-- | includes/common.inc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/includes/common.inc b/includes/common.inc index ea57e6593..0167620c9 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -552,7 +552,7 @@ function drupal_http_request($url, array $options = array()) { // user-agent is used to ensure that multiple testing sessions running at the // same time won't interfere with each other as they would if the database // prefix were stored statically in a file or database variable. - if (preg_match("/simpletest\d+/", $db_prefix, $matches)) { + if (is_string($db_prefix) && preg_match("/^simpletest\d+/", $db_prefix, $matches)) { $options['headers']['User-Agent'] = $matches[0]; } @@ -809,7 +809,7 @@ function _drupal_log_error($error, $fatal = FALSE) { // When running inside the testing framework, we relay the errors // to the tested site by the way of HTTP headers. - if (preg_match("/^simpletest\d+/", $_SERVER['HTTP_USER_AGENT']) && !headers_sent() && (!defined('SIMPLETEST_COLLECT_ERRORS') || SIMPLETEST_COLLECT_ERRORS)) { + if (isset($_SERVER['HTTP_USER_AGENT']) && preg_match("/^simpletest\d+$/", $_SERVER['HTTP_USER_AGENT']) && !headers_sent() && (!defined('SIMPLETEST_COLLECT_ERRORS') || SIMPLETEST_COLLECT_ERRORS)) { // $number does not use drupal_static as it should not be reset // as it uniquely identifies each PHP error. static $number = 0; |