I'm writing this one down mainly as a matter of posting a solution to a problem I came across.

Per the title, I was getting "Cannot use string offset as array" errors when trying to save a node. I found out that it comes from the following larger issues:

1) The database seems to be corrupted when you delete a field from a multifield, or when the machine name of the multifield field and the sub-field are too long. Attempting to re-create the multifield field with similar names doesn't solve anything.

2) When you try to create a node with this corrupted field data, an error is thrown. Sometimes saving empty fields will lead to "Array" being inserted as a field value.

To fix:

1) Delete the multifield from the node
2) Go into the database and make sure everything is removed from the field_config and field_config_instance tables
3) Re-create the field

If you need to delete a field from the multifield, you need to delete the entire field and rebuild. If this can be reproduced perhaps someone could work on a patch, otherwise I'm posting this as a workaround and we can leave it at "fixed."

Comments

laboratory.mike created an issue. See original summary.

dave reid’s picture

Status: Needs review » Active
chrisrockwell’s picture

I can't reproduce this on 7.x-1.x-dev.

I tried several things:
- Deleting a field within multifield when the field had content (won't allow)
- Deleting a field within multifield when no content (works)
- Adding a field with same name back, try repeating the above steps
- Adding field with long machine name, went through above steps with that as well.
- Adding the same multifield to another bundle via the "Existing field" select list and going through above.

raul.silva’s picture

StatusFileSize
new0 bytes

I found a way to avoid the same issue but it was shown when adding and deleting items in the UI, not on submission

raul.silva’s picture

StatusFileSize
new855 bytes