updated core to 7.80

This commit is contained in:
2021-07-12 10:11:08 +02:00
parent 7b1e954f7f
commit 5656f5a68a
236 changed files with 4149 additions and 888 deletions

View File

@@ -7,7 +7,7 @@ files[] = aggregator.test
configure = admin/config/services/aggregator/settings
stylesheets[all][] = aggregator.css
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -5,7 +5,7 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -6,7 +6,7 @@ core = 7.x
files[] = block.test
configure = admin/structure/block
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -263,7 +263,7 @@ function block_page_build(&$page) {
$all_regions = system_region_list($theme);
$item = menu_get_item();
if ($item['path'] != 'admin/structure/block/demo/' . $theme) {
if ($item === FALSE || $item['path'] != 'admin/structure/block/demo/' . $theme) {
// Load all region content assigned via blocks.
foreach (array_keys($all_regions) as $region) {
// Assign blocks to region.
@@ -283,7 +283,6 @@ function block_page_build(&$page) {
}
else {
// Append region description if we are rendering the regions demo page.
$item = menu_get_item();
if ($item['path'] == 'admin/structure/block/demo/' . $theme) {
foreach (system_region_list($theme, REGIONS_VISIBLE, FALSE) as $region) {
$description = '<div class="block-region">' . $all_regions[$region] . '</div>';

View File

@@ -5,7 +5,7 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -13,7 +13,7 @@ regions[footer] = Footer
regions[highlighted] = Highlighted
regions[help] = Help
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -5,7 +5,7 @@ version = VERSION
core = 7.x
files[] = blog.test
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -7,7 +7,7 @@ files[] = book.test
configure = admin/content/book/settings
stylesheets[all][] = book.css
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -101,7 +101,7 @@ class BookTestCase extends DrupalWebTestCase {
// Check that book pages display along with the correct outlines and
// previous/next links.
$this->checkBookNode($book, array($nodes[0], $nodes[3], $nodes[4]), FALSE, FALSE, $nodes[0], array());
$this->checkBookNode($book, array($nodes[0], $nodes[3], $nodes[4]), FALSE, FALSE, $nodes[0]);
$this->checkBookNode($nodes[0], array($nodes[1], $nodes[2]), $book, $book, $nodes[1], array($book));
$this->checkBookNode($nodes[1], NULL, $nodes[0], $nodes[0], $nodes[2], array($book, $nodes[0]));
$this->checkBookNode($nodes[2], NULL, $nodes[1], $nodes[0], $nodes[3], array($book, $nodes[0]));
@@ -124,7 +124,7 @@ class BookTestCase extends DrupalWebTestCase {
// First we must set $this->book to the second book, so that the
// correct regex will be generated for testing the outline.
$this->book = $other_book;
$this->checkBookNode($other_book, array($node), FALSE, FALSE, $node, array());
$this->checkBookNode($other_book, array($node), FALSE, FALSE, $node);
$this->checkBookNode($node, NULL, $other_book, $other_book, FALSE, array($other_book));
}
@@ -144,9 +144,9 @@ class BookTestCase extends DrupalWebTestCase {
* @param $next
* (optional) Next link node. Defaults to FALSE.
* @param $breadcrumb
* The nodes that should be displayed in the breadcrumb.
* (optional) The nodes that should be displayed in the breadcrumb.
*/
function checkBookNode($node, $nodes, $previous = FALSE, $up = FALSE, $next = FALSE, array $breadcrumb) {
function checkBookNode($node, $nodes = NULL, $previous = FALSE, $up = FALSE, $next = FALSE, array $breadcrumb = array()) {
// $number does not use drupal_static as it should not be reset
// since it uniquely identifies each call to checkBookNode().
static $number = 0;

View File

@@ -5,7 +5,7 @@ version = VERSION
core = 7.x
files[] = color.test
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -734,8 +734,9 @@ function _color_blend($img, $hex1, $hex2, $alpha) {
* Converts a hex color into an RGB triplet.
*/
function _color_unpack($hex, $normalize = FALSE) {
if (strlen($hex) == 4) {
$hex = $hex[1] . $hex[1] . $hex[2] . $hex[2] . $hex[3] . $hex[3];
$hex = substr($hex, 1);
if (strlen($hex) == 3) {
$hex = $hex[0] . $hex[0] . $hex[1] . $hex[1] . $hex[2] . $hex[2];
}
$c = hexdec($hex);
for ($i = 16; $i >= 0; $i -= 8) {

View File

@@ -9,7 +9,7 @@ files[] = comment.test
configure = admin/content/comment
stylesheets[all][] = comment.css
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -9,9 +9,6 @@
* Implements hook_uninstall().
*/
function comment_uninstall() {
// Delete comment_body field.
field_delete_field('comment_body');
// Remove variables.
variable_del('comment_block_count');
$node_types = array_keys(node_type_get_types());

View File

@@ -6,6 +6,7 @@
*/
class CommentHelperCase extends DrupalWebTestCase {
protected $super_user;
protected $admin_user;
protected $web_user;
protected $node;
@@ -19,6 +20,7 @@ class CommentHelperCase extends DrupalWebTestCase {
parent::setUp($modules);
// Create users and test node.
$this->super_user = $this->drupalCreateUser(array('access administration pages', 'administer modules'));
$this->admin_user = $this->drupalCreateUser(array('administer content types', 'administer comments', 'administer blocks', 'administer actions', 'administer fields'));
$this->web_user = $this->drupalCreateUser(array('access comments', 'post comments', 'create article content', 'edit own comments'));
$this->node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'uid' => $this->web_user->uid));
@@ -2264,3 +2266,56 @@ class CommentNodeChangesTestCase extends CommentHelperCase {
$this->assertFalse(comment_load($comment->id), 'The comment could not be loaded after the node was deleted.');
}
}
/**
* Tests uninstalling the comment module.
*/
class CommentUninstallTestCase extends CommentHelperCase {
public static function getInfo() {
return array(
'name' => 'Comment module uninstallation',
'description' => 'Tests that the comments module can be properly uninstalled.',
'group' => 'Comment',
);
}
function testCommentUninstall() {
$this->drupalLogin($this->super_user);
// Disable comment module.
$edit['modules[Core][comment][enable]'] = FALSE;
$this->drupalPost('admin/modules', $edit, t('Save configuration'));
$this->assertText(t('The configuration options have been saved.'), 'Comment module was disabled.');
// Uninstall comment module.
$edit = array('uninstall[comment]' => 'comment');
$this->drupalPost('admin/modules/uninstall', $edit, t('Uninstall'));
$this->drupalPost(NULL, NULL, t('Uninstall'));
$this->assertText(t('The selected modules have been uninstalled.'), 'Comment module was uninstalled.');
// Run cron and clear field cache so that comment fields and instances
// marked for deletion are actually removed.
$this->cronRun();
field_cache_clear();
// Verify that comment fields have been removed.
$all_fields = array_keys(field_info_field_map());
$this->assertFalse(in_array('comment_body', $all_fields), 'Comment fields were removed by uninstall.');
// Verify that comment field instances have been removed (or at least marked
// for deletion).
// N.B. field_read_instances does an INNER JOIN on field_config so if the
// comment_body row has been removed successfully from there no instances
// will be returned, but that does not guarantee that no rows are left over
// in the field_config_instance table.
$count = db_select('field_config_instance', 'fci')
->condition('entity_type', 'comment')
->condition('field_name', 'comment_body')
->condition('deleted', 0)
->countQuery()
->execute()
->fetchField();
$this->assertTrue($count == 0, 'Comment field instances were removed by uninstall.');
}
}

View File

@@ -6,7 +6,7 @@ core = 7.x
files[] = contact.test
configure = admin/structure/contact
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -5,7 +5,7 @@ version = VERSION
core = 7.x
files[] = contextual.test
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -7,7 +7,7 @@ files[] = dashboard.test
dependencies[] = block
configure = admin/dashboard/customize
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -5,7 +5,7 @@ version = VERSION
core = 7.x
files[] = dblog.test
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -11,7 +11,7 @@ dependencies[] = field_sql_storage
required = TRUE
stylesheets[all][] = theme/field.css
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -7,7 +7,7 @@ dependencies[] = field
files[] = field_sql_storage.test
required = TRUE
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -434,6 +434,81 @@ function field_sql_storage_field_storage_load($entity_type, $entities, $age, $fi
}
}
/**
* Callback for array_filter().
*/
function _field_sql_storage_write_compare_filter_callback($value) {
return NULL !== $value && '' !== $value;
}
/**
* Cleanup field values for later values comparison.
*
* @param array $field
* Field info as returned by field_info_field_by_id().
*
* @param array $array
* Field values to cleanup.
*
* @return array
* Filtered values.
*/
function _field_sql_storage_write_compare_filter($field, $array) {
foreach ($array as $language => $items) {
if (empty($items)) {
unset($array[$language]);
}
else {
foreach ($items as $delta => $item) {
// This should not happen but some modules provide invalid data to the
// field API.
if (!is_array($item)) {
continue;
}
// Let's start by pruning empty values and non storable values.
$array[$language][$delta] = array_filter(array_intersect_key($item, $field['columns']), '_field_sql_storage_write_compare_filter_callback');
// Ordering is important because for widget elements and loaded columns
// from database order might differ and give false positives on field
// value change, especially with complex fields such as image fields.
ksort($array[$language][$delta]);
}
}
}
return $array;
}
/**
* Compare a single field value for both entities and tell us if it changed.
*
* @param array $field
* Loaded field structure.
* @param object $entity1
* First entity to compare.
* @param object $entity2
* Second entity to compare.
*
* @return bool
* True if field value changed, false otherwise.
*/
function _field_sql_storage_write_compare($field, $entity1, $entity2) {
$field_name = $field['field_name'];
if (empty($entity1->$field_name) && empty($entity2->$field_name)) {
// Both are empty we can safely assume that it did not change.
return FALSE;
}
if (!isset($entity1->$field_name) || !isset($entity2->$field_name)) {
// One of them is missing but not the other the value changed.
return TRUE;
}
// We need to proceed to deep array comparison, but we cannot do it naively:
// in most cases the field values come from the edit form, and some Form API
// widget values that are not field columns may be present. We need to clean
// up both original and new field values before comparison.
$items1 = _field_sql_storage_write_compare_filter($field, (array) $entity1->$field_name);
$items2 = _field_sql_storage_write_compare_filter($field, (array) $entity2->$field_name);
return $items1 != $items2;
}
/**
* Implements hook_field_storage_write().
*/
@@ -443,8 +518,29 @@ function field_sql_storage_field_storage_write($entity_type, $entity, $op, $fiel
$vid = $id;
}
// Check if the given entity is a new revision or not. In case of a new
// revision creation, we cannot skip any field.
if (!empty($vid) && !empty($entity->original)) {
list(, $original_vid) = entity_extract_ids($entity_type, $entity->original);
if (NULL === $original_vid) {
$original_vid = $id;
}
$is_new_revision = $original_vid != $vid;
}
else {
$is_new_revision = FALSE;
}
// Allow this optimization to be optional.
$skip_unchanged_fields = variable_get('field_sql_storage_skip_writing_unchanged_fields', FALSE);
foreach ($fields as $field_id) {
$field = field_info_field_by_id($field_id);
if ($skip_unchanged_fields && !$is_new_revision && !empty($entity->original) && !_field_sql_storage_write_compare($field, $entity, $entity->original)) {
continue;
}
$field_name = $field['field_name'];
$table_name = _field_sql_storage_tablename($field);
$revision_name = _field_sql_storage_revision_tablename($field);

View File

@@ -281,6 +281,69 @@ class FieldSqlStorageTestCase extends DrupalWebTestCase {
$this->assertEqual($count, 1, 'NULL field translation is wiped.');
}
/**
* Tests the expected return values of _field_sql_storage_write_compare().
*/
public function testFieldCompareDataModification() {
$langcode = LANGUAGE_NONE;
$field_info = field_info_field($this->field_name);
// Make sure we have 2 sample field values that are unique.
$value1 = 0;
$value2 = 0;
while ($value1 == $value2) {
$value1 = mt_rand();
$value2 = (string) mt_rand();
}
// Create the 2 entities to compare.
$entity = field_test_create_stub_entity();
$entity->{$this->field_name}[$langcode][]['value'] = $value1;
$entity1 = clone $entity;
$entity2 = clone $entity;
// Make sure that it correctly compares identical entities.
$this->assert(!_field_sql_storage_write_compare($field_info, $entity1, $entity2), 'The entities are identical.');
// Compare to an empty object.
$this->assert(_field_sql_storage_write_compare($field_info, $entity1, new stdClass()), 'The entity is not the same as an empty object.');
// Change one of the values.
$entity2->{$this->field_name}[$langcode][0]['value'] = $value2;
$this->assert(_field_sql_storage_write_compare($field_info, $entity1, $entity2), 'The values are not the same.');
// Reset $entity2.
$entity2 = clone $entity;
// Duplicate the value on one of the entities.
$entity1->{$this->field_name}[$langcode][]['value'] = $value1;
$this->assert(_field_sql_storage_write_compare($field_info, $entity1, $entity2), 'The fields do not have the same number of values.');
// Add a second value to both entities.
$entity2->{$this->field_name}[$langcode][]['value'] = $value2;
$this->assert(_field_sql_storage_write_compare($field_info, $entity1, $entity2), 'The values are not the same.');
// Replace the array containing the value with the actual value.
$entity2->{$this->field_name}[$langcode] = $entity2->{$this->field_name}[$langcode][0];
$this->assert(_field_sql_storage_write_compare($field_info, $entity1, $entity2), 'The array to hold field values is replaced by the value.');
// Null one value.
$entity2->{$this->field_name}[$langcode] = NULL;
$this->assert(_field_sql_storage_write_compare($field_info, $entity1, $entity2), 'One field is NULL and the other is not.');
// Null both values.
$entity1->{$this->field_name}[$langcode] = NULL;
$this->assert(!_field_sql_storage_write_compare($field_info, $entity1, $entity2), 'Both fields are NULL.');
// Unset one of the fields.
unset($entity2->{$this->field_name});
$this->assert(_field_sql_storage_write_compare($field_info, $entity1, $entity2), 'One field structure is unset.');
// Unset both of the fields.
unset($entity1->{$this->field_name});
$this->assert(!_field_sql_storage_write_compare($field_info, $entity1, $entity2), 'Both field structures are unset.');
}
/**
* Test trying to update a field with data.
*/
@@ -313,9 +376,13 @@ class FieldSqlStorageTestCase extends DrupalWebTestCase {
$field = array('field_name' => 'test_text', 'type' => 'text', 'settings' => array('max_length' => 255));
$field = field_create_field($field);
// Attempt to update the field in a way that would break the storage.
// Attempt to update the field in a way that would break the storage. The
// parenthesis suffix is needed because SQLite has *very* relaxed rules for
// data types, so we actually need to provide an invalid SQL syntax in order
// to break it.
// @see https://www.sqlite.org/datatype3.html
$prior_field = $field;
$field['settings']['max_length'] = -1;
$field['settings']['max_length'] = '-1)';
try {
field_update_field($field);
$this->fail(t('Update succeeded.'));

View File

@@ -7,7 +7,7 @@ dependencies[] = field
dependencies[] = options
files[] = tests/list.test
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -5,7 +5,7 @@ package = Testing
version = VERSION
hidden = TRUE
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -6,7 +6,7 @@ core = 7.x
dependencies[] = field
files[] = number.test
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -174,7 +174,7 @@ class NumberFieldTestCase extends DrupalWebTestCase {
),
'display' => array(
'default' => array(
'type' => 'number_float',
'type' => 'number_decimal',
),
),
);

View File

@@ -6,7 +6,7 @@ core = 7.x
dependencies[] = field
files[] = options.test
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -7,7 +7,7 @@ dependencies[] = field
files[] = text.test
required = TRUE
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -6,7 +6,7 @@ files[] = field_test.entity.inc
version = VERSION
hidden = TRUE
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -240,111 +240,6 @@ function field_test_field_storage_delete_revision($entity_type, $entity, $fields
_field_test_storage_data($data);
}
/**
* Implements hook_field_storage_query().
*/
function field_test_field_storage_query($field_id, $conditions, $count, &$cursor = NULL, $age) {
$data = _field_test_storage_data();
$load_current = $age == FIELD_LOAD_CURRENT;
$field = field_info_field_by_id($field_id);
$field_columns = array_keys($field['columns']);
$field_data = $data[$field['id']];
$sub_table = $load_current ? 'current' : 'revisions';
// We need to sort records by entity type and entity id.
usort($field_data[$sub_table], '_field_test_field_storage_query_sort_helper');
// Initialize results array.
$return = array();
$entity_count = 0;
$rows_count = 0;
$rows_total = count($field_data[$sub_table]);
$skip = $cursor;
$skipped = 0;
foreach ($field_data[$sub_table] as $row) {
if ($count != FIELD_QUERY_NO_LIMIT && $entity_count >= $count) {
break;
}
if ($row->field_id == $field['id']) {
$match = TRUE;
$condition_deleted = FALSE;
// Add conditions.
foreach ($conditions as $condition) {
@list($column, $value, $operator) = $condition;
if (empty($operator)) {
$operator = is_array($value) ? 'IN' : '=';
}
switch ($operator) {
case '=':
$match = $match && $row->{$column} == $value;
break;
case '<>':
case '<':
case '<=':
case '>':
case '>=':
eval('$match = $match && ' . $row->{$column} . ' ' . $operator . ' '. $value);
break;
case 'IN':
$match = $match && in_array($row->{$column}, $value);
break;
case 'NOT IN':
$match = $match && !in_array($row->{$column}, $value);
break;
case 'BETWEEN':
$match = $match && $row->{$column} >= $value[0] && $row->{$column} <= $value[1];
break;
case 'STARTS_WITH':
case 'ENDS_WITH':
case 'CONTAINS':
// Not supported.
$match = FALSE;
break;
}
// Track condition on 'deleted'.
if ($column == 'deleted') {
$condition_deleted = TRUE;
}
}
// Exclude deleted data unless we have a condition on it.
if (!$condition_deleted && $row->deleted) {
$match = FALSE;
}
if ($match) {
if (!isset($skip) || $skipped >= $skip) {
$cursor++;
// If querying all revisions and the entity type has revisions, we need
// to key the results by revision_ids.
$entity_type = entity_get_info($row->type);
$id = ($load_current || empty($entity_type['entity keys']['revision'])) ? $row->entity_id : $row->revision_id;
if (!isset($return[$row->type][$id])) {
$return[$row->type][$id] = entity_create_stub_entity($row->type, array($row->entity_id, $row->revision_id, $row->bundle));
$entity_count++;
}
}
else {
$skipped++;
}
}
}
$rows_count++;
// The query is complete if we walked the whole array.
if ($count != FIELD_QUERY_NO_LIMIT && $rows_count >= $rows_total) {
$cursor = FIELD_QUERY_COMPLETE;
}
}
return $return;
}
/**
* Sort helper for field_test_field_storage_query().
*
@@ -455,13 +350,13 @@ function field_test_field_attach_rename_bundle($bundle_old, $bundle_new) {
function field_test_field_attach_delete_bundle($entity_type, $bundle, $instances) {
$data = _field_test_storage_data();
foreach ($instances as $field_name => $instance) {
$field = field_info_field($field_name);
foreach ($instances as $instance) {
$field = field_info_field_by_id($instance['field_id']);
if ($field['storage']['type'] == 'field_test_storage') {
$field_data = &$data[$field['id']];
foreach (array('current', 'revisions') as $sub_table) {
foreach ($field_data[$sub_table] as &$row) {
if ($row->bundle == $bundle_old) {
if ($row->bundle == $bundle) {
$row->deleted = TRUE;
}
}

View File

@@ -1026,6 +1026,10 @@ function field_ui_display_overview_form($form, &$form_state, $entity_type, $bund
$instance['display'][$view_mode]['type'] = $formatter_type;
$formatter = field_info_formatter_types($formatter_type);
// For hidden fields, $formatter will be NULL, but we expect an array later.
// To maintain BC, but avoid PHP 7.4 Notices, ensure $formatter is an array
// with a 'module' element.
$formatter['module'] = isset($formatter['module']) ? $formatter['module'] : '';
$instance['display'][$view_mode]['module'] = $formatter['module'];
$instance['display'][$view_mode]['settings'] = $settings;

View File

@@ -6,7 +6,7 @@ core = 7.x
dependencies[] = field
files[] = field_ui.test
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -265,6 +265,12 @@ function field_ui_menu_title($instance) {
* Menu access callback for the 'view mode display settings' pages.
*/
function _field_ui_view_mode_menu_access($entity_type, $bundle, $view_mode, $access_callback) {
// It's good practice to call func_get_args() at the beginning of a function
// to avoid problems with function parameters being modified later. The
// behavior of func_get_args() changed in PHP7.
// @see https://www.php.net/manual/en/migration70.incompatible.php#migration70.incompatible.other.func-parameter-modified
$all_args = func_get_args();
// First, determine visibility according to the 'use custom display'
// setting for the view mode.
$bundle = field_extract_bundle($entity_type, $bundle);
@@ -275,7 +281,6 @@ function _field_ui_view_mode_menu_access($entity_type, $bundle, $view_mode, $acc
// part of _menu_check_access().
if ($visibility) {
// Grab the variable 'access arguments' part.
$all_args = func_get_args();
$args = array_slice($all_args, 4);
$callback = empty($access_callback) ? 0 : trim($access_callback);
if (is_numeric($callback)) {

View File

@@ -593,7 +593,7 @@ function file_field_widget_uri($field, $instance, $data = array()) {
/**
* The #value_callback for the file_generic field element.
*/
function file_field_widget_value($element, $input = FALSE, $form_state) {
function file_field_widget_value($element, $input = FALSE, $form_state = array()) {
if ($input) {
// Checkboxes lose their value when empty.
// If the display field is present make sure its unchecked value is saved.
@@ -955,17 +955,14 @@ function theme_file_upload_help($variables) {
if (isset($upload_validators['file_validate_image_resolution'])) {
$max = $upload_validators['file_validate_image_resolution'][0];
$min = $upload_validators['file_validate_image_resolution'][1];
if ($min && $max && $min == $max) {
$descriptions[] = t('Images must be exactly !size pixels.', array('!size' => '<strong>' . $max . '</strong>'));
}
elseif ($min && $max) {
$descriptions[] = t('Images must be between !min and !max pixels.', array('!min' => '<strong>' . $min . '</strong>', '!max' => '<strong>' . $max . '</strong>'));
if ($min && $max) {
$descriptions[] = t('Images must be at least !min pixels. Images larger than !max pixels will be resized.', array('!min' => '<strong>' . $min . '</strong>', '!max' => '<strong>' . $max . '</strong>'));
}
elseif ($min) {
$descriptions[] = t('Images must be larger than !min pixels.', array('!min' => '<strong>' . $min . '</strong>'));
$descriptions[] = t('Images must be at least !min pixels.', array('!min' => '<strong>' . $min . '</strong>'));
}
elseif ($max) {
$descriptions[] = t('Images must be smaller than !max pixels.', array('!max' => '<strong>' . $max . '</strong>'));
$descriptions[] = t('Images larger than !max pixels will be resized.', array('!max' => '<strong>' . $max . '</strong>'));
}
}

View File

@@ -6,7 +6,7 @@ core = 7.x
dependencies[] = field
files[] = tests/file.test
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -281,10 +281,11 @@ function file_ajax_upload() {
}
// Otherwise just add the new content class on a placeholder.
else {
$form['#suffix'] .= '<span class="ajax-new-content"></span>';
$form['#suffix'] = (isset($form['#suffix']) ? $form['#suffix'] : '') . '<span class="ajax-new-content"></span>';
}
$form['#prefix'] .= theme('status_messages');
$form['#prefix'] = (isset($form['#prefix']) ? $form['#prefix'] : '') . theme('status_messages');
$output = drupal_render($form);
$js = drupal_add_js();
$settings = drupal_array_merge_deep_array($js['settings']['data']);

View File

@@ -409,7 +409,7 @@ class FileManagedFileElementTestCase extends FileFieldTestCase {
'form_token' => 'invalid token',
);
$this->drupalPost($path, $edit, t('Save'));
$this->assertText('The form has become outdated. Copy any unsaved work in the form below');
$this->assertText('The form has become outdated.');
$last_fid = $this->getLastFileId();
$this->assertEqual($last_fid_prior, $last_fid, 'File was not saved when uploaded with an invalid form token.');

View File

@@ -5,7 +5,7 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -202,7 +202,7 @@ function callback_filter_settings($form, &$form_state, $filter, $format, $defaul
*/
function callback_filter_prepare($text, $filter, $format, $langcode, $cache, $cache_id) {
// Escape <code> and </code> tags.
$text = preg_replace('|<code>(.+?)</code>|se', "[codefilter_code]$1[/codefilter_code]", $text);
$text = preg_replace('|<code>(.+?)</code>|s', "[codefilter_code]$1[/codefilter_code]", $text);
return $text;
}
@@ -234,7 +234,7 @@ function callback_filter_prepare($text, $filter, $format, $langcode, $cache, $ca
* @ingroup callbacks
*/
function callback_filter_process($text, $filter, $format, $langcode, $cache, $cache_id) {
$text = preg_replace('|\[codefilter_code\](.+?)\[/codefilter_code\]|se', "<pre>$1</pre>", $text);
$text = preg_replace('|\[codefilter_code\](.+?)\[/codefilter_code\]|s', "<pre>$1</pre>", $text);
return $text;
}

View File

@@ -7,7 +7,7 @@ files[] = filter.test
required = TRUE
configure = admin/config/content/formats
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -9,7 +9,7 @@ files[] = forum.test
configure = admin/structure/forum
stylesheets[all][] = forum.css
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -922,7 +922,8 @@ function forum_get_topics($tid, $sortby, $forum_per_page) {
);
$order = _forum_get_topic_order($sortby);
for ($i = 0; $i < count($forum_topic_list_header); $i++) {
// Skip element with index 0 which is NULL.
for ($i = 1; $i < count($forum_topic_list_header); $i++) {
if ($forum_topic_list_header[$i]['field'] == $order['field']) {
$forum_topic_list_header[$i]['sort'] = $order['sort'];
}

View File

@@ -5,7 +5,7 @@ version = VERSION
core = 7.x
files[] = help.test
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -7,7 +7,7 @@ dependencies[] = file
files[] = image.test
configure = admin/config/media/image-styles
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -1022,7 +1022,7 @@ class ImageFieldDisplayTestCase extends ImageFieldTestCase {
$this->drupalGet('node/add/article');
$this->assertText(t('Files must be less than 50 KB.'), 'Image widget max file size is displayed on article form.');
$this->assertText(t('Allowed file types: ' . $test_image_extension . '.'), 'Image widget allowed file types displayed on article form.');
$this->assertText(t('Images must be between 10x10 and 100x100 pixels.'), 'Image widget allowed resolution displayed on article form.');
$this->assertText(t('Images must be at least 10x10 pixels. Images larger than 100x100 pixels will be resized.'), 'Image widget allowed resolution displayed on article form.');
// We have to create the article first and then edit it because the alt
// and title fields do not display until the image has been attached.

View File

@@ -6,7 +6,7 @@ core = 7.x
files[] = image_module_test.module
hidden = TRUE
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -6,7 +6,7 @@ core = 7.x
files[] = locale.test
configure = admin/config/regional/language
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -564,6 +564,7 @@ function locale_language_types_info() {
* Implements hook_language_negotiation_info().
*/
function locale_language_negotiation_info() {
require_once DRUPAL_ROOT . '/includes/locale.inc';
$file = 'includes/locale.inc';
$providers = array();

View File

@@ -5,7 +5,7 @@ package = Testing
version = VERSION
hidden = TRUE
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -6,7 +6,7 @@ core = 7.x
files[] = menu.test
configure = admin/structure/menu
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -9,7 +9,7 @@ required = TRUE
configure = admin/structure/types
stylesheets[all][] = node.css
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -2659,7 +2659,7 @@ function node_feed($nids = FALSE, $channel = array()) {
* An array in the format expected by drupal_render().
*/
function node_view_multiple($nodes, $view_mode = 'teaser', $weight = 0, $langcode = NULL) {
$build = array();
$build = array('nodes' => array());
$entities_by_view_mode = entity_view_mode_prepare('node', $nodes, $view_mode, $langcode);
foreach ($entities_by_view_mode as $entity_view_mode => $entities) {
field_attach_prepare_view('node', $entities, $entity_view_mode, $langcode);

View File

@@ -5,7 +5,7 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -5,7 +5,7 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -5,7 +5,7 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -142,7 +142,8 @@ function _openid_xrds_parse($raw_xml) {
// For PHP version >= 5.2.11, we can use this function to protect against
// malicious doctype declarations and other unexpected entity loading.
// However, we will not rely on it, and reject any XML with a DOCTYPE.
$disable_entity_loader = function_exists('libxml_disable_entity_loader');
// libxml_disable_entity_loader() is deprecated in PHP >= 8.0.
$disable_entity_loader = function_exists('libxml_disable_entity_loader') && PHP_VERSION_ID < 80000;
if ($disable_entity_loader) {
$load_entities = libxml_disable_entity_loader(TRUE);
}

View File

@@ -5,7 +5,7 @@ package = Core
core = 7.x
files[] = openid.test
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -743,7 +743,7 @@ function openid_association_request($public) {
return $request;
}
function openid_authentication_request($claimed_id, $identity, $return_to = '', $assoc_handle = '', $service) {
function openid_authentication_request($claimed_id, $identity, $return_to, $assoc_handle, $service) {
global $base_url;
module_load_include('inc', 'openid');

View File

@@ -6,7 +6,7 @@ core = 7.x
dependencies[] = openid
hidden = TRUE
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -4,7 +4,7 @@ package = Core
version = VERSION
core = 7.x
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -6,7 +6,7 @@ core = 7.x
files[] = path.test
configure = admin/config/search/path
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -5,7 +5,7 @@ version = VERSION
core = 7.x
files[] = php.test
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -6,7 +6,7 @@ core = 7.x
files[] = poll.test
stylesheets[all][] = poll.css
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -11,7 +11,7 @@ configure = admin/config/people/profile
; See user_system_info_alter().
hidden = TRUE
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -5,7 +5,7 @@ version = VERSION
core = 7.x
files[] = rdf.test
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -6,7 +6,7 @@ core = 7.x
hidden = TRUE
dependencies[] = blog
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -219,7 +219,7 @@ class SearchQuery extends SelectQueryExtender {
}
$phrase = FALSE;
// Strip off phrase quotes.
if ($match[2]{0} == '"') {
if ($match[2][0] == '"') {
$match[2] = substr($match[2], 1, -1);
$phrase = TRUE;
$this->simple = FALSE;

View File

@@ -8,7 +8,7 @@ files[] = search.test
configure = admin/config/search/settings
stylesheets[all][] = search.css
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -1172,7 +1172,7 @@ function search_excerpt($keys, $text) {
}
else {
$info = search_simplify_excerpt_match($key, $text, $included[$key], $boundary);
if ($info['where']) {
if (isset($info['where'])) {
$p = $info['where'];
if ($info['keyword']) {
$foundkeys[] = $info['keyword'];

View File

@@ -5,7 +5,7 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -5,7 +5,7 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -5,7 +5,7 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -6,7 +6,7 @@ core = 7.x
files[] = shortcut.test
configure = admin/config/user-interface/shortcut
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -1677,15 +1677,12 @@ class DrupalWebTestCase extends DrupalTestCase {
file_unmanaged_delete_recursive($this->originalFileDirectory . '/simpletest/' . substr($this->databasePrefix, 10));
// Remove all prefixed tables.
$tables = db_find_tables($this->databasePrefix . '%');
$connection_info = Database::getConnectionInfo('default');
$tables = db_find_tables($connection_info['default']['prefix']['default'] . '%');
$tables = db_find_tables_d8('%');
if (empty($tables)) {
$this->fail('Failed to find test tables to drop.');
}
$prefix_length = strlen($connection_info['default']['prefix']['default']);
foreach ($tables as $table) {
if (db_drop_table(substr($table, $prefix_length))) {
if (db_drop_table($table)) {
unset($tables[$table]);
}
}
@@ -1693,8 +1690,14 @@ class DrupalWebTestCase extends DrupalTestCase {
$this->fail('Failed to drop all prefixed tables.');
}
// In PHP 8 some tests encounter problems when shutdown code tries to
// access the database connection after it's been explicitly closed, for
// example the destructor of DrupalCacheArray. We avoid this by not fully
// destroying the test database connection.
$close = \PHP_VERSION_ID < 80000;
// Get back to the original connection.
Database::removeConnection('default');
Database::removeConnection('default', $close);
Database::renameConnection('simpletest_original_default', 'default');
// Restore original shutdown callbacks array to prevent original
@@ -3087,7 +3090,7 @@ class DrupalWebTestCase extends DrupalTestCase {
* @return
* TRUE on pass, FALSE on fail.
*/
protected function assertTextHelper($text, $message = '', $group, $not_exists) {
protected function assertTextHelper($text, $message, $group, $not_exists) {
if ($this->plainTextContent === FALSE) {
$this->plainTextContent = filter_xss($this->drupalGetContent(), array());
}
@@ -3153,7 +3156,7 @@ class DrupalWebTestCase extends DrupalTestCase {
* @return
* TRUE on pass, FALSE on fail.
*/
protected function assertUniqueTextHelper($text, $message = '', $group, $be_unique) {
protected function assertUniqueTextHelper($text, $message, $group, $be_unique) {
if ($this->plainTextContent === FALSE) {
$this->plainTextContent = filter_xss($this->drupalGetContent(), array());
}
@@ -3259,7 +3262,7 @@ class DrupalWebTestCase extends DrupalTestCase {
* @param $callback
* The name of the theme function to invoke; e.g. 'links' for theme_links().
* @param $variables
* (optional) An array of variables to pass to the theme function.
* An array of variables to pass to the theme function.
* @param $expected
* The expected themed output string.
* @param $message
@@ -3275,7 +3278,7 @@ class DrupalWebTestCase extends DrupalTestCase {
* @return
* TRUE on pass, FALSE on fail.
*/
protected function assertThemeOutput($callback, array $variables = array(), $expected, $message = '', $group = 'Other') {
protected function assertThemeOutput($callback, array $variables, $expected, $message = '', $group = 'Other') {
$output = theme($callback, $variables);
$this->verbose('Variables:' . '<pre>' . check_plain(var_export($variables, TRUE)) . '</pre>'
. '<hr />' . 'Result:' . '<pre>' . check_plain(var_export($output, TRUE)) . '</pre>'

View File

@@ -33,6 +33,7 @@ files[] = tests/pager.test
files[] = tests/password.test
files[] = tests/path.test
files[] = tests/registry.test
files[] = tests/request_sanitizer.test
files[] = tests/schema.test
files[] = tests/session.test
files[] = tests/tablesort.test
@@ -57,7 +58,7 @@ files[] = tests/upgrade/update.trigger.test
files[] = tests/upgrade/update.field.test
files[] = tests/upgrade/update.user.test
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -563,7 +563,7 @@ function simpletest_clean_environment() {
* Removed prefixed tables from the database that are left over from crashed tests.
*/
function simpletest_clean_database() {
$tables = db_find_tables(Database::getConnection()->prefixTables('{simpletest}') . '%');
$tables = db_find_tables_d8(Database::getConnection()->prefixTables('{simpletest}') . '%');
$schema = drupal_get_schema_unprocessed('simpletest');
$count = 0;
foreach (array_diff_key($tables, $schema) as $table) {

View File

@@ -164,13 +164,16 @@ class SimpleTestFunctionalTest extends DrupalWebTestCase {
$this->pass(t('Test ID is @id.', array('@id' => $this->testId)));
// Generates a warning.
$i = 1 / 0;
$a = '';
foreach ($a as $b) {
}
// Call an assert function specific to that class.
$this->assertNothing();
// Generates a warning inside a PHP function.
array_key_exists(NULL, NULL);
// Generates 3 warnings inside a PHP function.
simplexml_load_string('<fake>');
debug('Foo', 'Debug');
}
@@ -195,19 +198,21 @@ class SimpleTestFunctionalTest extends DrupalWebTestCase {
$this->assertAssertion(t('Invalid permission %permission.', array('%permission' => $this->invalid_permission)), 'Role', 'Fail', 'simpletest.test', 'SimpleTestFunctionalTest->stubTest()');
// Check that a warning is caught by simpletest.
$this->assertAssertion('Division by zero', 'Warning', 'Fail', 'simpletest.test', 'SimpleTestFunctionalTest->stubTest()');
// The exact error message differs between PHP versions so we check only
// the presense of the 'foreach' statement.
$this->assertAssertion('foreach()', 'Warning', 'Fail', 'simpletest.test', 'SimpleTestFunctionalTest->stubTest()');
// Check that the backtracing code works for specific assert function.
$this->assertAssertion('This is nothing.', 'Other', 'Pass', 'simpletest.test', 'SimpleTestFunctionalTest->stubTest()');
// Check that errors that occur inside PHP internal functions are correctly reported.
// The exact error message differs between PHP versions so we check only
// the function name 'array_key_exists'.
$this->assertAssertion('array_key_exists', 'Warning', 'Fail', 'simpletest.test', 'SimpleTestFunctionalTest->stubTest()');
// the function name 'simplexml_load_string'.
$this->assertAssertion('simplexml_load_string', 'Warning', 'Fail', 'simpletest.test', 'SimpleTestFunctionalTest->stubTest()');
$this->assertAssertion("Debug: 'Foo'", 'Debug', 'Fail', 'simpletest.test', 'SimpleTestFunctionalTest->stubTest()');
$this->assertEqual('6 passes, 5 fails, 2 exceptions, and 1 debug message', $this->childTestResults['summary'], 'Stub test summary is correct');
$this->assertEqual('6 passes, 5 fails, 4 exceptions, and 1 debug message', $this->childTestResults['summary'], 'Stub test summary is correct');
$this->test_ids[] = $test_id = $this->getTestIdFromResults();
$this->assertTrue($test_id, 'Found test ID in results.');

View File

@@ -5,7 +5,7 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -5,7 +5,7 @@ package = Testing
version = VERSION
hidden = TRUE
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -5,7 +5,7 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -5,7 +5,7 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -5,7 +5,7 @@ package = Testing
version = VERSION
hidden = TRUE
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -5,7 +5,7 @@ package = Testing
version = VERSION
hidden = TRUE
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -453,13 +453,13 @@ class BootstrapGetFilenameTestCase extends DrupalUnitTestCase {
/**
* Skips handling of "file not found" errors.
*/
public function fileNotFoundErrorHandler($error_level, $message, $filename, $line, $context) {
public function fileNotFoundErrorHandler($error_level, $message, $filename, $line) {
// Skip error handling if this is a "file not found" error.
if (strpos($message, 'is missing from the file system:') !== FALSE || strpos($message, 'has moved within the file system:') !== FALSE) {
$this->getFilenameTestTriggeredError = $message;
return;
}
_drupal_error_handler($error_level, $message, $filename, $line, $context);
_drupal_error_handler($error_level, $message, $filename, $line);
}
}
@@ -569,13 +569,13 @@ class BootstrapGetFilenameWebTestCase extends DrupalWebTestCase {
/**
* Skips handling of "file not found" errors.
*/
public function fileNotFoundErrorHandler($error_level, $message, $filename, $line, $context) {
public function fileNotFoundErrorHandler($error_level, $message, $filename, $line) {
// Skip error handling if this is a "file not found" error.
if (strpos($message, 'is missing from the file system:') !== FALSE || strpos($message, 'has moved within the file system:') !== FALSE) {
$this->getFilenameTestTriggeredError = $message;
return;
}
_drupal_error_handler($error_level, $message, $filename, $line, $context);
_drupal_error_handler($error_level, $message, $filename, $line);
}
/**

View File

@@ -1124,9 +1124,15 @@ class DrupalHTTPRequestTestCase extends DrupalWebTestCase {
$this->assertEqual($unable_to_parse->code, -1001, 'Returned with "-1001" error code.');
$this->assertEqual($unable_to_parse->error, 'unable to parse URL', 'Returned with "unable to parse URL" error message.');
// Fetch page.
$result = drupal_http_request(url('node', array('absolute' => TRUE)));
// Fetch page and check that the data parameter works with both array and string.
$data_array = array($this->randomName() => $this->randomString() . ' "\'');
$data_string = drupal_http_build_query($data_array);
$result = drupal_http_request(url('node', array('absolute' => TRUE)), array('data' => $data_array));
$this->assertEqual($result->code, 200, 'Fetched page successfully.');
$this->assertTrue(substr($result->request, -strlen($data_string)) === $data_string, 'Request ends with URL-encoded data when drupal_http_request() called using array.');
$result = drupal_http_request(url('node', array('absolute' => TRUE)), array('data' => $data_string));
$this->assertTrue(substr($result->request, -strlen($data_string)) === $data_string, 'Request ends with URL-encoded data when drupal_http_request() called using string.');
$this->drupalSetContent($result->data);
$this->assertTitle(t('Welcome to @site-name | @site-name', array('@site-name' => variable_get('site_name', 'Drupal'))), 'Site title matches.');
@@ -2045,6 +2051,32 @@ class DrupalRenderTestCase extends DrupalWebTestCase {
// The elements should appear in output in the same order as the array.
$this->assertTrue(strpos($output, $second) < strpos($output, $first), 'Elements were not sorted.');
// The order of children with same weight should be preserved.
$element_mixed_weight = array(
'child5' => array('#weight' => 10),
'child3' => array('#weight' => -10),
'child1' => array(),
'child4' => array('#weight' => 10),
'child2' => array(),
'child6' => array('#weight' => 10),
'child9' => array(),
'child8' => array('#weight' => 10),
'child7' => array(),
);
$expected = array(
'child3',
'child1',
'child2',
'child9',
'child7',
'child5',
'child4',
'child6',
'child8',
);
$this->assertEqual($expected, element_children($element_mixed_weight, TRUE), 'Order of elements with the same weight is preserved.');
}
/**
@@ -2601,8 +2633,8 @@ class DrupalErrorCollectionUnitTest extends DrupalWebTestCase {
$this->assertEqual(count($this->collectedErrors), 3, 'Three errors were collected');
if (count($this->collectedErrors) == 3) {
$this->assertError($this->collectedErrors[0], 'Notice', 'error_test_generate_warnings()', 'error_test.module', 'Undefined variable: bananas');
$this->assertError($this->collectedErrors[1], 'Warning', 'error_test_generate_warnings()', 'error_test.module', 'Division by zero');
$this->assertError($this->collectedErrors[0], 'Notice', 'error_test_generate_warnings()', 'error_test.module', 'Object of class stdClass could not be converted to int');
$this->assertError($this->collectedErrors[1], 'Warning', 'error_test_generate_warnings()', 'error_test.module', \PHP_VERSION_ID < 80000 ? 'Invalid argument supplied for foreach()' : 'foreach() argument must be of type array|object, string given');
$this->assertError($this->collectedErrors[2], 'User warning', 'error_test_generate_warnings()', 'error_test.module', 'Drupal is awesome');
}
else {

View File

@@ -7,7 +7,7 @@ stylesheets[all][] = common_test.css
stylesheets[print][] = common_test.print.css
hidden = TRUE
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -5,7 +5,7 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -5,7 +5,7 @@ package = Testing
version = VERSION
hidden = TRUE
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -217,5 +217,24 @@ function database_test_schema() {
),
);
$schema['virtual'] = array(
'description' => 'Basic test table with a reserved name.',
'fields' => array(
'id' => array(
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'function' => array(
'description' => "A column with a reserved name.",
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
'default' => '',
),
),
'primary key' => array('id'),
);
return $schema;
}

View File

@@ -163,6 +163,12 @@ class DatabaseTestCase extends DrupalWebTestCase {
'priority' => 3,
))
->execute();
db_insert('virtual')
->fields(array(
'function' => 'Function value 1',
))
->execute();
}
}
@@ -3457,7 +3463,6 @@ class DatabaseQueryTestCase extends DatabaseTestCase {
->fetchField();
$this->assertFalse($result, 'SQL injection attempt did not result in a row being inserted in the database table.');
}
}
/**
@@ -3750,21 +3755,36 @@ class DatabaseTransactionTestCase extends DatabaseTestCase {
$transaction = db_transaction();
$this->insertRow('row');
$this->executeDDLStatement();
// Rollback the outer transaction.
set_error_handler(array($this, 'rollBackWithoutTransactionErrorHandler'));
try {
// Rollback the outer transaction.
$transaction->rollback();
unset($transaction);
// @TODO: an exception should be triggered here, but is not, because
// "ROLLBACK" fails silently in MySQL if there is no transaction active.
// $this->fail(t('Rolling back a transaction containing DDL should fail.'));
// @see \DatabaseConnection_mysql::rollback()
if (PHP_VERSION_ID >= 80000) {
$this->fail('Rolling back a transaction containing DDL should produce a warning.');
}
}
catch (DatabaseTransactionNoActiveException $e) {
$this->pass('Rolling back a transaction containing DDL should fail.');
catch (Exception $e) {
$this->assertEqual('Rollback attempted when there is no active transaction.', $e->getMessage());
}
restore_error_handler();
unset($transaction);
$this->assertRowPresent('row');
}
}
/**
* Special handling of "rollback without transaction" errors.
*/
public function rollBackWithoutTransactionErrorHandler($error_level, $message, $filename, $line) {
// Throw an exception if this is a "rollback without transaction" error.
if (strpos($message, 'Rollback attempted when there is no active transaction.') !== FALSE ) {
throw new Exception('Rollback attempted when there is no active transaction.');
}
_drupal_error_handler($error_level, $message, $filename, $line);
}
/**
* Insert a single row into the testing table.
*/
@@ -4033,6 +4053,8 @@ class ConnectionUnitTest extends DrupalUnitTestCase {
protected $monitor;
protected $originalCount;
protected $skipTest;
public static function getInfo() {
return array(
'name' => 'Connection unit tests',
@@ -4053,7 +4075,7 @@ class ConnectionUnitTest extends DrupalUnitTestCase {
// @todo Make this test driver-agnostic, or find a proper way to skip it.
// @see http://drupal.org/node/1273478
$connection_info = Database::getConnectionInfo('default');
$this->skipTest = (bool) $connection_info['default']['driver'] != 'mysql';
$this->skipTest = (bool) ($connection_info['default']['driver'] != 'mysql');
if ($this->skipTest) {
// Insert an assertion to prevent Simpletest from interpreting the test
// as failure.
@@ -4238,5 +4260,178 @@ class ConnectionUnitTest extends DrupalUnitTestCase {
// Verify that we are back to the original connection count.
$this->assertNoConnection($id);
}
}
/**
* Test reserved keyword handling (introduced for MySQL 8+)
*/
class DatabaseReservedKeywordTestCase extends DatabaseTestCase {
public static function getInfo() {
return array(
'name' => 'Reserved Keywords',
'description' => 'Test handling of reserved keywords.',
'group' => 'Database',
);
}
function setUp() {
parent::setUp('database_test');
}
public function testTableNameQuoting() {
// Test db_query with {table} pattern.
$record = db_query('SELECT * FROM {system} LIMIT 1')->fetchObject();
$this->assertTrue(isset($record->filename), 'Successfully queried the {system} table.');
$connection = Database::getConnection()->getConnectionOptions();
if ($connection['driver'] === 'sqlite') {
// In SQLite simpletest's prefixed db tables exist in their own schema
// (e.g. simpletest124904.system), so we cannot test the schema.{table}
// syntax here as the table name will have the schema name prepended to it
// when prefixes are processed.
$this->assert(TRUE, 'Skipping schema.{system} test for SQLite.');
}
else {
$database = $connection['database'];
// Test db_query with schema.{table} pattern
db_query('SELECT * FROM ' . $database . '.{system} LIMIT 1')->fetchObject();
$this->assertTrue(isset($record->filename), 'Successfully queried the schema.{system} table.');
}
}
public function testSelectReservedWordTableCount() {
$rows = db_select('virtual')
->countQuery()
->execute()
->fetchField();
$this->assertEqual($rows, 1, 'Successful count query on a table with a reserved name.');
}
public function testSelectReservedWordTableSpecificField() {
$record = db_select('virtual')
->fields('virtual', array('function'))
->execute()
->fetchAssoc();
$this->assertEqual($record['function'], 'Function value 1', 'Successfully read a field from a table with a name and column which are reserved words.');
}
public function testSelectReservedWordTableAllFields() {
$record = db_select('virtual')
->fields('virtual')
->execute()
->fetchAssoc();
$this->assertEqual($record['function'], 'Function value 1', 'Successful all_fields query from a table with a name and column which are reserved words.');
}
public function testSelectReservedWordAliasCount() {
$rows = db_select('test', 'character')
->countQuery()
->execute()
->fetchField();
$this->assertEqual($rows, 4, 'Successful count query using an alias which is a reserved word.');
}
public function testSelectReservedWordAliasSpecificFields() {
$record = db_select('test', 'high_priority')
->fields('high_priority', array('name'))
->condition('age', 27)
->execute()->fetchAssoc();
$this->assertEqual($record['name'], 'George', 'Successful query using an alias which is a reserved word.');
}
public function testSelectReservedWordAliasAllFields() {
$record = db_select('test', 'high_priority')
->fields('high_priority')
->condition('age', 27)
->execute()->fetchAssoc();
$this->assertEqual($record['name'], 'George', 'Successful all_fields query using an alias which is a reserved word.');
}
public function testInsertReservedWordTable() {
$num_records_before = db_query('SELECT COUNT(*) FROM {virtual}')->fetchField();
db_insert('virtual')
->fields(array(
'function' => 'Inserted function',
))
->execute();
$num_records_after = db_query('SELECT COUNT(*) FROM {virtual}')->fetchField();
$this->assertIdentical($num_records_before + 1, (int) $num_records_after, 'Successful insert into a table with a name and column which are reserved words.');
}
public function testDeleteReservedWordTable() {
$delete = db_delete('virtual')
->condition('function', 'Function value 1');
$num_deleted = $delete->execute();
$this->assertEqual($num_deleted, 1, "Deleted 1 record from a table with a name and column which are reserved words..");
}
function testTruncateReservedWordTable() {
db_truncate('virtual')->execute();
$num_records_after = db_query("SELECT COUNT(*) FROM {virtual}")->fetchField();
$this->assertEqual(0, $num_records_after, 'Truncated a table with a reserved name.');
}
function testUpdateReservedWordTable() {
$num_updated = db_update('virtual')
->fields(array('function' => 'Updated function'))
->execute();
$this->assertIdentical($num_updated, 1, 'Updated 1 record in a table with a name and column which are reserved words.');
}
function testMergeReservedWordTable() {
$key = db_query('SELECT id FROM {virtual} LIMIT 1')->fetchField();
$num_records_before = db_query('SELECT COUNT(*) FROM {virtual}')->fetchField();
db_merge('virtual')
->key(array('id' => $key))
->fields(array('function' => 'Merged function'))
->execute();
$num_records_after = db_query('SELECT COUNT(*) FROM {virtual}')->fetchField();
$this->assertIdentical($num_records_before, $num_records_after, 'Successful merge query on a table with a name and column which are reserved words.');
}
}
/**
* Test table prefix handling.
*/
class DatabaseTablePrefixTestCase extends DatabaseTestCase {
public static function getInfo() {
return array(
'name' => 'Table prefixes',
'description' => 'Test handling of table prefixes.',
'group' => 'Database',
);
}
public function testSchemaDotTablePrefixes() {
// Get a copy of the default connection options.
$db = Database::getConnection('default', 'default');
$connection_options = $db->getConnectionOptions();
if ($connection_options['driver'] === 'sqlite') {
// In SQLite simpletest's prefixed db tables exist in their own schema
// (e.g. simpletest124904.system), so we cannot test the schema.table
// prefix syntax here.
$this->assert(TRUE, 'Skipping schema.table prefixed tables test for SQLite.');
return;
}
$db_name = $connection_options['database'];
// This prefix is usually something like simpletest12345
$test_prefix = $connection_options['prefix']['default'];
// Set up a new connection with table prefixes in the form "schema.table"
$prefixed = $connection_options;
$prefixed['prefix'] = array(
'default' => $test_prefix,
'users' => $db_name . '.' . $test_prefix,
'role' => $db_name . '.' . $test_prefix,
);
Database::addConnectionInfo('default', 'prefixed', $prefixed);
// Test that the prefixed database connection can query the prefixed tables.
$num_users_prefixed = Database::getConnection('prefixed', 'default')->query('SELECT COUNT(1) FROM {users}')->fetchField();
$this->assertTrue((int) $num_users_prefixed > 0, 'Successfully queried the users table using a schema.table prefix');
$num_users_default = Database::getConnection('default', 'default')->query('SELECT COUNT(1) FROM {users}')->fetchField();
$this->assertEqual($num_users_default, $num_users_prefixed, 'Verified results of query using a connection with schema.table prefixed tables');
}
}

View File

@@ -7,7 +7,7 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -5,7 +5,7 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -5,7 +5,7 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -6,7 +6,7 @@ core = 7.x
dependencies[] = entity_cache_test_dependency
hidden = TRUE
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -5,7 +5,7 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -5,7 +5,7 @@ package = Testing
version = VERSION
hidden = TRUE
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -5,7 +5,7 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -22,13 +22,13 @@ class DrupalErrorHandlerTestCase extends DrupalWebTestCase {
function testErrorHandler() {
$error_notice = array(
'%type' => 'Notice',
'!message' => 'Undefined variable: bananas',
'!message' => 'Object of class stdClass could not be converted to int',
'%function' => 'error_test_generate_warnings()',
'%file' => drupal_realpath('modules/simpletest/tests/error_test.module'),
);
$error_warning = array(
'%type' => 'Warning',
'!message' => 'Division by zero',
'!message' => \PHP_VERSION_ID < 80000 ? 'Invalid argument supplied for foreach()' : 'foreach() argument must be of type array|object, string given',
'%function' => 'error_test_generate_warnings()',
'%file' => drupal_realpath('modules/simpletest/tests/error_test.module'),
);
@@ -113,4 +113,3 @@ class DrupalErrorHandlerTestCase extends DrupalWebTestCase {
$this->assertNoRaw($message, format_string('Did not find error message: !message.', array('!message' => $message)));
}
}

View File

@@ -5,7 +5,7 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2019-05-08
version = "7.67"
; Information added by Drupal.org packaging script on 2021-04-21
version = "7.80"
project = "drupal"
datestamp = "1557336079"
datestamp = "1619021862"

View File

@@ -40,9 +40,13 @@ function error_test_generate_warnings($collect_errors = FALSE) {
// Tell Drupal error reporter to send errors to Simpletest or not.
define('SIMPLETEST_COLLECT_ERRORS', $collect_errors);
// This will generate a notice.
$monkey_love = $bananas;
$notice = new \stdClass();
$notice == 1 ? 1 : 0;
// This will generate a warning.
$awesomely_big = 1/0;
$a = '';
foreach ($a as $b) {
}
// This will generate a user error.
trigger_error("Drupal is awesome", E_USER_WARNING);
return "";

Some files were not shown because too many files have changed in this diff Show More