This is a follow up question from this question. I now am sure that it's the Field Collection module that causes the error message "Can only flip string and integer values!"
. My previous question was about HOW to find which module causes the error. I have now used Xdebug and Atom to backtrace the stack like this:
When the error arises on row 175 in /includes/entity.inc I have these values in the variable $ids:
$passed_ids = !empty($ids) ? array_flip($ids) : FALSE;
As you can see it's an array in an array, which causes the error, as array_flip() only can flip integers and strings, not arrays.
The array in an array value comes from row 8016 in /includes/common.inc:
function entity_load($entity_type, $ids = FALSE, $conditions = array(), $reset = FALSE) {
if ($reset) {
entity_get_controller($entity_type)->resetCache();
}
return entity_get_controller($entity_type)->load($ids, $conditions);
}
Going one step further back in the stack, the value comes from these rows in sites/all/modules/entity/entity.module:
function entity_load_single($entity_type, $id) {
$entities = entity_load($entity_type, array($id));
return reset($entities);
}
And if you bare with me, one more step back in the stack... to sites/all/modules/field_collection/field_collection_entity.inc, where I find these rows (row 265):
public function hostEntity() {
if ($this->fetchHostDetails()) {
if (!isset($this->hostEntity) && $this->isInUse()) {
$this->hostEntity = entity_load_single($this->hostEntityType, $this->hostEntityId);
}
elseif (!isset($this->hostEntity) && $this->hostEntityRevisionId) {
$this->hostEntity = entity_revision_load($this->hostEntityType, $this->hostEntityRevisionId);
}
return $this->hostEntity;
}
}
Now to my question... what happens is that the host entity id
(26391) is passed up the stack once for every field collection field that exists on the page. 10 field collection field instances = 10 error messages on row 175 in /includes/entity.inc
(and equally many on row 388).
Can anyone tell me what I might be doing wrong? I suspect I have drawn this error upon myself. All other posts I have read among the issues for Field Collection suggests that this shouldn't be a problem any more. Otherwise I would have posted this in as an issue for Field Collection.
The field types I am using in these Field Collection fields are: Image, Long text and Link.
What more info can I give you to solve this problem? I am not an expert coder, so maybe there is something obvious in the stack above, that I don't see?