I have a node edit form for a node type containing a "Content reference field" called "field_test". The URL I am using is "node/add/my_content_type?edit[field_test]=1

Where 1 is the node ID.

The form comes up fine and prepopulates fine, but on save I get a WSOD. After trial and error debugging, I finally got this this error to show up:

Fatal error: [] operator not supported for strings in prepopulate\src\Controller\prepopulateController.php on line 51

Comments

mrvee’s picture

I've just tried to set up a prepopulated node on Drupal 8.0.1.

Running into the same WSOD when I try to prepopulate a List(Text) field on a node/add

All other fields are Text fields and working perfect.

"Fatal error: [] operator not supported for strings in /var/www/clients/client0/web19/web/modules/prepopulate/src/Controller/prepopulateController.php on line 51"

mrvee’s picture

I'm not a programmer, so not sure if this is the right approach, but the following seems to have fixed it for me for the tie being:

line 51 in prepopulateController.php:
$form['widget']['#value'][] = $request_slice;

changed to:
$form['widget']['#value'] = $request_slice;

If this is the solution, maybe someone could create a quick patch, unfortunately I don't have the know how.

juliencarnot’s picture

This seems to be an exact duplicate of issue https://www.drupal.org/node/2712529 , which has a patch attached.