diff --git a/core/lib/Drupal/Core/Entity/Field/Type/Field.php b/core/lib/Drupal/Core/Entity/Field/Type/Field.php index 305fc1f..cd0215d 100644 --- a/core/lib/Drupal/Core/Entity/Field/Type/Field.php +++ b/core/lib/Drupal/Core/Entity/Field/Type/Field.php @@ -55,9 +55,6 @@ public function getValue() { if (!$item->isEmpty()) { $values[$delta] = $item->getValue(); } - else { - $values[$delta] = NULL; - } } return $values; } diff --git a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceItemTest.php b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceItemTest.php index cc089fb..5319a1d 100644 --- a/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceItemTest.php +++ b/core/modules/entity_reference/lib/Drupal/entity_reference/Tests/EntityReferenceItemTest.php @@ -97,5 +97,11 @@ public function testEntityReferenceItem() { $entity->field_test_taxonomy->target_id = $term2->id(); $this->assertEqual($entity->field_test_taxonomy->entity->id(), $term2->id()); $this->assertEqual($entity->field_test_taxonomy->entity->name, $term2->name); + + // Delete terms so we have nothing to reference and try again + $term->delete(); + $term2->delete(); + $entity = entity_create('entity_test', array('name' => $this->randomName())); + $entity->save(); } } diff --git a/core/modules/image/lib/Drupal/image/Tests/ImageItemTest.php b/core/modules/image/lib/Drupal/image/Tests/ImageItemTest.php index 7f863cf..73cf876 100644 --- a/core/modules/image/lib/Drupal/image/Tests/ImageItemTest.php +++ b/core/modules/image/lib/Drupal/image/Tests/ImageItemTest.php @@ -111,6 +111,11 @@ public function testImageItem() { // Check that the image item can be set to the referenced file directly. $entity->image_test = $this->image; $this->assertEqual($entity->image_test->fid, $this->image->id()); + + // Delete the image and try to save the entity again. + $this->image->delete(); + $entity = entity_create('entity_test', array('mame' => $this->randomName())); + $entity->save(); } }