core security update
This commit is contained in:
@@ -853,6 +853,13 @@ class DrupalWebTestCase extends DrupalTestCase {
|
||||
*/
|
||||
protected $cookieFile = NULL;
|
||||
|
||||
/**
|
||||
* The cookies of the page currently loaded in the internal browser.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $cookies = array();
|
||||
|
||||
/**
|
||||
* Additional cURL options.
|
||||
*
|
||||
@@ -942,7 +949,6 @@ class DrupalWebTestCase extends DrupalTestCase {
|
||||
protected function drupalCreateNode($settings = array()) {
|
||||
// Populate defaults array.
|
||||
$settings += array(
|
||||
'body' => array(LANGUAGE_NONE => array(array())),
|
||||
'title' => $this->randomName(8),
|
||||
'comment' => 2,
|
||||
'changed' => REQUEST_TIME,
|
||||
@@ -957,6 +963,12 @@ class DrupalWebTestCase extends DrupalTestCase {
|
||||
'language' => LANGUAGE_NONE,
|
||||
);
|
||||
|
||||
// Add the body after the language is defined so that it may be set
|
||||
// properly.
|
||||
$settings += array(
|
||||
'body' => array($settings['language'] => array(array())),
|
||||
);
|
||||
|
||||
// Use the original node's created time for existing nodes.
|
||||
if (isset($settings['created']) && !isset($settings['date'])) {
|
||||
$settings['date'] = format_date($settings['created'], 'custom', 'Y-m-d H:i:s O');
|
||||
@@ -1015,9 +1027,7 @@ class DrupalWebTestCase extends DrupalTestCase {
|
||||
'description' => '',
|
||||
'help' => '',
|
||||
'title_label' => 'Title',
|
||||
'body_label' => 'Body',
|
||||
'has_title' => 1,
|
||||
'has_body' => 1,
|
||||
);
|
||||
// Imposed values for a custom type.
|
||||
$forced = array(
|
||||
@@ -1067,7 +1077,7 @@ class DrupalWebTestCase extends DrupalTestCase {
|
||||
$lines = array(16, 256, 1024, 2048, 20480);
|
||||
$count = 0;
|
||||
foreach ($lines as $line) {
|
||||
simpletest_generate_file('text-' . $count++, 64, $line);
|
||||
simpletest_generate_file('text-' . $count++, 64, $line, 'text');
|
||||
}
|
||||
|
||||
// Copy other test files from simpletest.
|
||||
@@ -1695,8 +1705,10 @@ class DrupalWebTestCase extends DrupalTestCase {
|
||||
$GLOBALS['conf']['language_default'] = $this->originalLanguageDefault;
|
||||
}
|
||||
|
||||
// Close the CURL handler.
|
||||
// Close the CURL handler and reset the cookies array so test classes
|
||||
// containing multiple tests are not polluted.
|
||||
$this->curlClose();
|
||||
$this->cookies = array();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2221,6 +2233,7 @@ class DrupalWebTestCase extends DrupalTestCase {
|
||||
|
||||
// Submit the POST request.
|
||||
$return = drupal_json_decode($this->drupalPost(NULL, $edit, array('path' => $ajax_path, 'triggering_element' => $triggering_element), $options, $headers, $form_html_id, $extra_post));
|
||||
$this->assertIdentical($this->drupalGetHeader('X-Drupal-Ajax-Token'), '1', 'Ajax response header found.');
|
||||
|
||||
// Change the page content by applying the returned commands.
|
||||
if (!empty($ajax_settings) && !empty($return)) {
|
||||
@@ -2257,8 +2270,13 @@ class DrupalWebTestCase extends DrupalTestCase {
|
||||
if ($wrapperNode) {
|
||||
// ajax.js adds an enclosing DIV to work around a Safari bug.
|
||||
$newDom = new DOMDocument();
|
||||
// DOM can load HTML soup. But, HTML soup can throw warnings,
|
||||
// suppress them.
|
||||
$newDom->loadHTML('<div>' . $command['data'] . '</div>');
|
||||
$newNode = $dom->importNode($newDom->documentElement->firstChild->firstChild, TRUE);
|
||||
// Suppress warnings thrown when duplicate HTML IDs are
|
||||
// encountered. This probably means we are replacing an element
|
||||
// with the same ID.
|
||||
$newNode = @$dom->importNode($newDom->documentElement->firstChild->firstChild, TRUE);
|
||||
$method = isset($command['method']) ? $command['method'] : $ajax_settings['method'];
|
||||
// The "method" is a jQuery DOM manipulation function. Emulate
|
||||
// each one using PHP's DOMNode API.
|
||||
@@ -2580,6 +2598,11 @@ class DrupalWebTestCase extends DrupalTestCase {
|
||||
*
|
||||
* @param $xpath
|
||||
* The xpath string to use in the search.
|
||||
* @param array $arguments
|
||||
* An array of arguments with keys in the form ':name' matching the
|
||||
* placeholders in the query. The values may be either strings or numeric
|
||||
* values.
|
||||
*
|
||||
* @return
|
||||
* The return value of the xpath search. For details on the xpath string
|
||||
* format and return values see the SimpleXML documentation,
|
||||
@@ -2751,7 +2774,7 @@ class DrupalWebTestCase extends DrupalTestCase {
|
||||
$path = substr($path, $length);
|
||||
}
|
||||
// Ensure that we have an absolute path.
|
||||
if ($path[0] !== '/') {
|
||||
if (empty($path) || $path[0] !== '/') {
|
||||
$path = '/' . $path;
|
||||
}
|
||||
// Finally, prepend the $base_url.
|
||||
|
Reference in New Issue
Block a user