diff --git a/core/modules/image/image.module b/core/modules/image/image.module
index 5b0d9a3..5e981dd 100644
--- a/core/modules/image/image.module
+++ b/core/modules/image/image.module
@@ -420,13 +420,14 @@ function image_entity_presave(EntityInterface $entity, $type) {
     return;
   }
 
-  if (!empty($entity->settings['default_image']['fid'][0])) {
-    $entity->settings['default_image']['fid'] = $entity->settings['default_image']['fid'][0];
-  }
-  if ($fid = $entity->settings['default_image']['fid']) {
+  // The value of a managed_file element can be an array if #extended == TRUE.
+  $fid = isset($entity->settings['default_image']['fid']['fids']) ? $entity->settings['default_image']['fid']['fids'] : $entity->settings['default_image']['fid'];
+  $fid = (array) $fid;
+  if ($fid && isset($fid[0]) && $fid[0] != 0) {
     $original_fid = isset($entity->original) ? $entity->original->settings['default_image']['fid'] : NULL;
-    if ($fid != $original_fid) {
-      $image = \Drupal::service('image.factory')->get(file_load($fid)->getFileUri());
+    if ($entity->settings['default_image']['fid'] != $original_fid) {
+      $file = file_load(reset($fid));
+      $image = \Drupal::service('image.factory')->get($file->getFileUri());
       $entity->settings['default_image']['width'] = $image->getWidth();
       $entity->settings['default_image']['height'] = $image->getHeight();
     }
@@ -499,19 +500,17 @@ function image_field_instance_update(FieldInstanceInterface $field_instance) {
 
   $prior_instance = $field_instance->original;
 
-  // The value of a managed_file element can be an array if the #extended
-  // property is set to TRUE.
-  $fid_new = $field_instance->settings['default_image']['fid'];
-  if (isset($fid_new['fids'])) {
-    $fid_new = $fid_new['fids'];
-  }
-  $fid_old = $prior_instance->settings['default_image']['fid'];
-  if (isset($fid_old['fids'])) {
-    $fid_old = $fid_old['fids'];
-  }
+  // The value of a managed_file element can be an array if #extended == TRUE.
+  $fid_new = isset($field_instance->settings['default_image']['fid']['fids']) ? $field_instance->settings['default_image']['fid']['fids'] : $field_instance->settings['default_image']['fid'];
+  $fid_old = isset($prior_instance->settings['default_image']['fid']['fids']) ? $prior_instance->settings['default_image']['fid']['fids'] : $prior_instance->settings['default_image']['fid'];
+  // Ensure that $fid_new and $fid_old are arrays, because the field setting
+  // 'default_image' key 'fid' might be the fallback value 0, see the annotation
+  // block of \Drupal\image\Plugin\Field\FieldType\ImageItem.
+  $fid_old = (array) $fid_old;
+  $fid_new = (array) $fid_new;
 
   // If the old and new files do not match, update the default accordingly.
-  $file_new = $fid_new ? file_load($fid_new[0]) : FALSE;
+  $file_new = $fid_new ? file_load(reset($fid_new)) : FALSE;
   if ($fid_new != $fid_old) {
     // Save the new file, if present.
     if ($file_new) {
@@ -520,7 +519,7 @@ function image_field_instance_update(FieldInstanceInterface $field_instance) {
       \Drupal::service('file.usage')->add($file_new, 'image', 'default_image', $field_instance->uuid);
     }
     // Delete the old file, if present.
-    if ($fid_old && ($file_old = file_load($fid_old[0]))) {
+    if ($fid_old && ($file_old = file_load(reset($fid_old)))) {
       \Drupal::service('file.usage')->delete($file_old, 'image', 'default_image', $field_instance->uuid);
     }
   }
@@ -544,7 +543,8 @@ function image_field_entity_delete(FieldInterface $field) {
 
   // The value of a managed_file element can be an array if #extended == TRUE.
   $fid = (isset($field->settings['default_image']['fid']['fids']) ? $field->settings['default_image']['fid']['fids'] : $field->settings['default_image']['fid']);
-  if ($fid && ($file = file_load($fid[0]))) {
+  $fid = (array) $fid;
+  if ($fid && ($file = file_load(reset($fid)))) {
     \Drupal::service('file.usage')->delete($file, 'image', 'default_image', $field->uuid);
   }
 }
@@ -559,15 +559,12 @@ function image_field_instance_delete(FieldInstanceInterface $field_instance) {
     return;
   }
 
-  // The value of a managed_file element can be an array if the #extended
-  // property is set to TRUE.
-  $fid = $field_instance->settings['default_image']['fid'];
-  if (is_array($fid)) {
-    $fid = $fid['fid'];
-  }
+  // The value of a managed_file element can be an array if #extended == TRUE.
+  $fid = (isset($field_instance->settings['default_image']['fid']['fids']) ? $field_instance->settings['default_image']['fid']['fids'] : $field_instance->settings['default_image']['fid']);
+  $fid = (array) $fid;
 
   // Remove the default image when the instance is deleted.
-  if ($fid && ($file = file_load($fid))) {
+  if ($fid && ($file = file_load(reset($fid)))) {
     \Drupal::service('file.usage')->delete($file, 'image', 'default_image', $field_instance->uuid);
   }
 }
diff --git a/core/modules/image/lib/Drupal/image/Tests/ImageFieldDefaultImagesTest.php b/core/modules/image/lib/Drupal/image/Tests/ImageFieldDefaultImagesTest.php
index da68885..8244fa0 100644
--- a/core/modules/image/lib/Drupal/image/Tests/ImageFieldDefaultImagesTest.php
+++ b/core/modules/image/lib/Drupal/image/Tests/ImageFieldDefaultImagesTest.php
@@ -33,6 +33,14 @@ public static function getInfo() {
   public function testDefaultImages() {
     // Create files to use as the default images.
     $files = $this->drupalGetTestFiles('image');
+    // Create 10 files so the default image fids are not a single value.
+    for ($i = 1; $i <= 10; $i++) {
+      $filename = $this->randomName() . "$i";
+      $desired_filepath = 'public://' . $filename;
+      file_unmanaged_copy($files[0]->uri, $desired_filepath, FILE_EXISTS_ERROR);
+      $file = entity_create('file', array('uri' => $desired_filepath, 'filename' => $filename, 'name' => $filename));
+      $file->save();
+    }
     $default_images = array();
     foreach (array('field', 'instance', 'instance2', 'field_new', 'instance_new') as $image_target) {
       $file = entity_create('file', (array) array_pop($files));
@@ -173,7 +181,7 @@ public function testDefaultImages() {
     );
 
     // Upload a new default for the field.
-    $field->settings['default_image']['fid'] = array($default_images['field_new']->id());
+    $field->settings['default_image']['fid'] = $default_images['field_new']->id();
     $field->save();
 
     // Confirm that the new default is used on the article field settings form.
