diff -u b/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetBase.php b/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetBase.php --- b/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetBase.php +++ b/core/modules/field/lib/Drupal/field/Plugin/Type/Widget/WidgetBase.php @@ -296,7 +296,9 @@ // Let the widget turn the submitted values into actual field values. // Make sure the '_weight' entries are persisted in the process. $weights = array(); - if (isset($values[0]['_weight'])) { + // Check that $values[0] is an array, because if it's a string, then in + // PHP 5.3, ['_weight'] returns the first character. + if (isset($values[0]) && is_array($values[0]) && isset($values[0]['_weight'])) { foreach ($values as $delta => $value) { $weights[$delta] = $value['_weight']; } @@ -416,7 +418,7 @@ $cardinality = $this->fieldDefinition->getFieldCardinality(); $is_multiple = ($cardinality == FIELD_CARDINALITY_UNLIMITED) || ($cardinality > 1); if ($is_multiple && isset($items[0]->_weight)) { - $itemValues = $items->getValue(); + $itemValues = $items->getValue(TRUE); usort($itemValues, function ($a, $b) { $a_weight = (is_array($a) ? $a['_weight'] : 0); $b_weight = (is_array($b) ? $b['_weight'] : 0); diff -u b/core/modules/image/lib/Drupal/image/Plugin/field/formatter/ImageFormatterBase.php b/core/modules/image/lib/Drupal/image/Plugin/field/formatter/ImageFormatterBase.php --- b/core/modules/image/lib/Drupal/image/Plugin/field/formatter/ImageFormatterBase.php +++ b/core/modules/image/lib/Drupal/image/Plugin/field/formatter/ImageFormatterBase.php @@ -43,7 +43,7 @@ 'alt' => '', 'title' => '', 'entity' => $file, - 'fid' => $file->id(), + 'target_id' => $file->id(), ))); } } only in patch2: unchanged: --- a/core/modules/image/lib/Drupal/image/Tests/ImageFieldDefaultImagesTest.php +++ b/core/modules/image/lib/Drupal/image/Tests/ImageFieldDefaultImagesTest.php @@ -121,7 +121,7 @@ function testDefaultImages() { $article = $this->drupalCreateNode(array('type' => 'article')); $article_built = node_view($article); $this->assertEqual( - $article_built[$field_name]['#items'][0]['fid'], + $article_built[$field_name]['#items'][0]['target_id'], $default_images['instance']->id(), format_string( 'A new article node without an image has the expected default image file ID of @fid.', @@ -133,7 +133,7 @@ function testDefaultImages() { $page = $this->drupalCreateNode(array('type' => 'page')); $page_built = node_view($page); $this->assertEqual( - $page_built[$field_name]['#items'][0]['fid'], + $page_built[$field_name]['#items'][0]['target_id'], $default_images['instance2']->id(), format_string( 'A new page node without an image has the expected default image file ID of @fid.', @@ -160,7 +160,7 @@ function testDefaultImages() { $article_built = node_view($article = node_load($article->nid, TRUE)); $page_built = node_view($page = node_load($page->nid, TRUE)); $this->assertEqual( - $article_built[$field_name]['#items'][0]['fid'], + $article_built[$field_name]['#items'][0]['target_id'], $default_images['instance']->id(), format_string( 'An existing article node without an image has the expected default image file ID of @fid.', @@ -168,7 +168,7 @@ function testDefaultImages() { ) ); $this->assertEqual( - $page_built[$field_name]['#items'][0]['fid'], + $page_built[$field_name]['#items'][0]['target_id'], $default_images['instance2']->id(), format_string( 'An existing page node without an image has the expected default image file ID of @fid.', @@ -198,7 +198,7 @@ function testDefaultImages() { // Confirm the article uses the new default. $this->assertEqual( - $article_built[$field_name]['#items'][0]['fid'], + $article_built[$field_name]['#items'][0]['target_id'], $default_images['instance_new']->id(), format_string( 'An existing article node without an image has the expected default image file ID of @fid.', @@ -207,7 +207,7 @@ function testDefaultImages() { ); // Confirm the page remains unchanged. $this->assertEqual( - $page_built[$field_name]['#items'][0]['fid'], + $page_built[$field_name]['#items'][0]['target_id'], $default_images['instance2']->id(), format_string( 'An existing page node without an image has the expected default image file ID of @fid.', @@ -232,7 +232,7 @@ function testDefaultImages() { $page_built = node_view($page = node_load($page->nid, TRUE)); // Confirm the article uses the new field (not instance) default. $this->assertEqual( - $article_built[$field_name]['#items'][0]['fid'], + $article_built[$field_name]['#items'][0]['target_id'], $default_images['field_new']->id(), format_string( 'An existing article node without an image has the expected default image file ID of @fid.', @@ -241,7 +241,7 @@ function testDefaultImages() { ); // Confirm the page remains unchanged. $this->assertEqual( - $page_built[$field_name]['#items'][0]['fid'], + $page_built[$field_name]['#items'][0]['target_id'], $default_images['instance2']->id(), format_string( 'An existing page node without an image has the expected default image file ID of @fid.',