diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermIndexTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermIndexTest.php index cb50554..b89768b 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermIndexTest.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/TermIndexTest.php @@ -202,10 +202,9 @@ class TermIndexTest extends TaxonomyTestBase { $this->assertEqual(0, $index_count, 'Term 2 is not indexed.'); // Save terms 1 and 2 in the first field, and terms 2 and 3 in the second. - $update_node[$this->field_name_1][$langcode] = array(array('tid' => $term_1->tid), array('tid' => $term_2->tid)); - $update_node[$this->field_name_2][$langcode] = array(array('tid' => $term_3->tid), array('tid' => $term_2->tid)); - $updated_node = (object) $update_node; - node_save($updated_node); + $node->{$this->field_name_1}[$langcode] = array(array('tid' => $term_1->tid), array('tid' => $term_2->tid)); + $node->{$this->field_name_2}[$langcode] = array(array('tid' => $term_3->tid), array('tid' => $term_2->tid)); + $node->save(); // Delete the field 2 instance. field_delete_instance($this->instance_2); diff --git a/core/modules/taxonomy/taxonomy.module b/core/modules/taxonomy/taxonomy.module index 8fe5cd6..fc73de0 100644 --- a/core/modules/taxonomy/taxonomy.module +++ b/core/modules/taxonomy/taxonomy.module @@ -1670,7 +1670,7 @@ function taxonomy_taxonomy_term_delete(Term $term) { } /** - * Implements hook_field_delete_instance() + * Implements hook_field_delete_instance(). */ function taxonomy_field_delete_instance($instance) { if (variable_get('taxonomy_maintain_index_table', TRUE) && $instance['entity_type'] == 'node') { @@ -1688,7 +1688,7 @@ function taxonomy_field_delete_instance($instance) { foreach ($nids->execute() as $item) { db_delete('taxonomy_index')->condition('nid', $item->nid)->execute(); $node = node_load($item->nid); - field_attach_update('node', $node); + taxonomy_build_node_index($node); } } }