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.
- Install the lastest 8.x
- Enable the language module. This error does not occur if the language module is disabled.
- 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
- Create an Article node with a title and body, but not image in the image field.
- Go to the node page (node/1) and select "Quick edit" from the contextual links.
- Change the body field test and click Save.
- You should see an AJAX error like this:
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
.
The $items variable on line 411 is set to array('0' => NULL)
which causes two bad things to happen:
- empty($items) returns FALSE.
- 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.
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.
Attachment | Size | Status | Test result | Operations |
---|---|---|---|---|
Screenshot_4_6_13_3_18_PM.png | 61.4 KB | Ignored: Check issue status. | None | None |
Screenshot_4_6_13_2_04_PM.png | 236.71 KB | Ignored: Check issue status. | None | None |
Screenshot_4_6_13_1_54_PM.png | 159.11 KB | Ignored: Check issue status. | None | None |