diff options
author | webchick <webchick@24967.no-reply.drupal.org> | 2012-08-18 13:15:22 +0200 |
---|---|---|
committer | webchick <webchick@24967.no-reply.drupal.org> | 2012-08-18 13:15:22 +0200 |
commit | ec12b314fac08e638ff4ed152cb7412739941166 (patch) | |
tree | e3e48006355d481012eaade90334852ba5ce70a1 /modules | |
parent | 124016b9e659215fc5eb5c682c60e4bdea8bdbbb (diff) | |
download | brdo-ec12b314fac08e638ff4ed152cb7412739941166.tar.gz brdo-ec12b314fac08e638ff4ed152cb7412739941166.tar.bz2 |
Issue #1671200 by chx, sun, jaimealsilva: Fixed Simpletest broken on 5.4: CURLOPT_COOKIEJAR cannot be NULL on php5-curl version 5.4.4.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/simpletest/drupal_web_test_case.php | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php index d83dbeb6f..19a6c94e4 100644 --- a/modules/simpletest/drupal_web_test_case.php +++ b/modules/simpletest/drupal_web_test_case.php @@ -1685,6 +1685,13 @@ class DrupalWebTestCase extends DrupalTestCase { if (!isset($this->curlHandle)) { $this->curlHandle = curl_init(); + + // Some versions/configurations of cURL break on a NULL cookie jar, so + // supply a real file. + if (empty($this->cookieFile)) { + $this->cookieFile = $this->public_files_directory . '/cookie.jar'; + } + $curl_options = array( CURLOPT_COOKIEJAR => $this->cookieFile, CURLOPT_URL => $base_url, @@ -1699,7 +1706,12 @@ class DrupalWebTestCase extends DrupalTestCase { $curl_options[CURLOPT_HTTPAUTH] = $this->httpauth_method; $curl_options[CURLOPT_USERPWD] = $this->httpauth_credentials; } - curl_setopt_array($this->curlHandle, $this->additionalCurlOptions + $curl_options); + // curl_setopt_array() returns FALSE if any of the specified options + // cannot be set, and stops processing any further options. + $result = curl_setopt_array($this->curlHandle, $this->additionalCurlOptions + $curl_options); + if (!$result) { + throw new Exception('One or more cURL options could not be set.'); + } // By default, the child session name should be the same as the parent. $this->session_name = session_name(); |