I've tried to gather as much info about this issue as possible. Sadly I'm not able to resolve it, although I felt I was close at times. Let's start with the pathology.

Steps to reproduce.

  1. Install the lastest 8.x
  2. Enable the language module. This error does not occur if the language module is disabled.
  3. Apply the patch in this issue (unless it has already been committed): #1960612: jQuery UI 1.10 update broke Create.js, and thus in-place editing
  4. Create an Article node with a title and body, but not image in the image field.
  5. Go to the node page (node/1) and select "Quick edit" from the contextual links.
  6. Change the body field test and click Save.
  7. You should see an AJAX error like this:

Screenshot of the AJAX error.

The text of the error

An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: /edit/form/node/2/body/und/full
StatusText: OK
ResponseText: Recoverable fatal error: Argument 1 passed to Drupal\file\FileUsage\DatabaseFileUsageBackend::add() must be an instance of Drupal\file\Plugin\Core\Entity\File, boolean given, called in /Users/jbeach/code/drupal/core/d8/core/modules/file/file.field.inc on line 267 and defined in Drupal\file\FileUsage\DatabaseFileUsageBackend->add() (line 51 of /Users/jbeach/code/drupal/core/d8/core/modules/file/lib/Drupal/file/FileUsage/DatabaseFileUsageBackend.php).

I think this error begins with a bad value assigned to the image field's language property. It surfaces like this:

$entity->field_image['und'] = array(0 => NULL);

I don't know where this assignment happens, that's been the focus of my debugging efforts. I assume it happens somewhere in the field composition stages. Here is what the error looks like in _field_invoke() in field.attach.inc.

Screenshot showing the $items of the field_image is set to a non-empty array that contains one index whose value is NULL.

The $items variable on line 411 is set to array('0' => NULL) which causes two bad things to happen:

  1. empty($items) returns FALSE.
  2. for loops on the $items variable run through one iteration on a value that is NULL.

These two behaviors account for the downstream errors. The first we see in the logs is a call to array_flip on an array that contains a non-string or non-number value because the value is NULL.

Screenshot of the FileStorageControll load method. array_flip is called on an array with one property at the zero index. The value of this item is NULL.

I've looked in the language module but don't see where where a NULL value is pushed into an array e.g. $someArray[] = NULL or something similar.

Comments

wim leers’s picture

Component: field system » edit.module
Assigned: Unassigned » wim leers
Issue tags: +sprint, +Spark

At this point it's — AFAICT — definitely still possible that the cause of this problem lies in the calling code, i.e. in edit.module.

wim leers’s picture

Title: AJAX save of an Article node results in an error related to the image field » Edit incompatible with language module (?): AJAX save of an Article node results in an error related to the image field

Better title.

swentel’s picture

Wondering if this is related to #1916858: EntityFormController::submit() returns an unrenderable $entity depending on hook_field_load() implementations which we opened after #501428: Date and time field type in core (see #149) - debugging some as this may as well be my fault - although I'm amazed by the fact that simply enabling the module blows these things up.

berdir’s picture

wim leers’s picture

wim leers’s picture

dcam’s picture

http://drupal.org/node/1427826 contains instructions for updating the issue summary with the summary template.

wim leers’s picture

No need for an issue summary update, the problem is clearly described. Not every issue has to strictly follow the issue summary format, it's only a guideline.

wim leers’s picture

Status: Active » Closed (cannot reproduce)

Hurray! :) I can't reproduce this anymore! This got fixed somewhere in the entity or field system I think :) It never made sense that Edit module could be at fault for this.

One less major!

wim leers’s picture

Issue summary: View changes

added some markup