Commit c8526e22 authored by catch's avatar catch
Browse files

Issue #2538260 by alexpott, mbaynton: Set CURLOPT_SAFE_UPLOAD to TRUE in Simpletest's CURL options

parent 88470f95
......@@ -1468,15 +1468,9 @@ public function randomStringValidate($string) {
return FALSE;
}
// Starting with a space means that length might not be what is expected.
// Starting with an @ sign causes CURL to fail if used in conjunction with a
// file upload. See https://www.drupal.org/node/2174997.
if (preg_match('/^(\s|@)/', $string)) {
return FALSE;
}
// Ending with a space means that length might not be what is expected.
if (preg_match('/\s$/', $string)) {
// Starting or ending with a space means that length might not be what is
// expected.
if (preg_match('/^\s|\s$/', $string)) {
return FALSE;
}
......
......@@ -1248,6 +1248,8 @@ protected function curlInitialize() {
CURLOPT_SSL_VERIFYHOST => FALSE,
CURLOPT_HEADERFUNCTION => array(&$this, 'curlHeaderCallback'),
CURLOPT_USERAGENT => $this->databasePrefix,
// Disable support for the @ prefix for uploading files.
CURLOPT_SAFE_UPLOAD => TRUE,
);
if (isset($this->httpAuthCredentials)) {
$curl_options[CURLOPT_HTTPAUTH] = $this->httpAuthMethod;
......@@ -1609,9 +1611,6 @@ protected function drupalGetXHR($path, array $options = array(), array $headers
* $edit = array();
* $edit['name[]'] = array('value1', 'value2');
* @endcode
*
* Note that when a form contains file upload fields, other
* fields cannot start with the '@' character.
* @param $submit
* Value of the submit button whose click is to be emulated. For example,
* t('Save'). The processing of the request depends on this value. For
......
......@@ -73,7 +73,7 @@ public function providerRandomStringValidate() {
array(FALSE, 'curry paste'),
array(TRUE, 'curry paste'),
array(TRUE, 'thai green curry paste'),
array(FALSE, '@startswithat'),
array(TRUE, '@startswithat'),
array(TRUE, 'contains@at'),
);
}
......
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