Drupal 7 and field_reference 1.0, I created a field_reference field with granularity entity and revision pointing to an image field on nodes. I then created a node with that image field set, and created another node with the field_reference field value set to the first image field. Getting these errors when I view the node with the field_reference value set:

Warning: array_flip() expects parameter 1 to be array, string given in DrupalDefaultEntityController->load() (line 173 of /Library/WebServer/Documents/wise_d7/drupal/includes/entity.inc).

Warning: Invalid argument supplied for foreach() in DatabaseCondition->compile() (line 1864 of /Library/WebServer/Documents/wise_d7/drupal/includes/database/query.inc).

PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '))' at line 2: SELECT revision.vid AS vid, base.uid AS uid, revision.title AS title, revision.log AS log, revision.status AS status, revision.comment AS comment, revision.promote AS promote, revision.sticky AS sticky, base.nid AS nid, base.type AS type, base.language AS language, base.created AS created, base.changed AS changed, base.tnid AS tnid, base.translate AS translate, revision.timestamp AS revision_timestamp, revision.uid AS revision_uid FROM {node} base INNER JOIN {node_revision} revision ON revision.nid = base.nid AND revision.vid = :revisionId WHERE (base.nid IN ()) ; Array ( [:revisionId] => 7 ) in DrupalDefaultEntityController->load() (line 191 of /Library/WebServer/Documents/wise_d7/drupal/includes/entity.inc).

I found and implemented a fix, patch coming.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

m4olivei’s picture

Status: Active » Needs review
FileSize
1.01 KB

Patch attached.

BBC’s picture

Thanks. This patch solved the issue for me. The error above describes what happens when the entitycache module is turned on. Disabling entitycache yields the following warnings.

  • Warning: array_flip() expects parameter 1 to be array, string given in DrupalDefaultEntityController->load() (line 175 of /var/www/clients/client3/web16/web/includes/entity.inc).
  • Warning: array_filter() expects parameter 1 to be array, string given in DrupalDefaultEntityController->cleanIds() (line 247 of /var/www/clients/client3/web16/web/includes/entity.inc).
  • Warning: array_map(): Argument #2 should be an array in DrupalDefaultEntityController->cleanIds() (line 248 of /var/www/clients/client3/web16/web/includes/entity.inc).
danielb’s picture

Status: Needs review » Fixed

  • danielb committed 1469f98 on 7.x-1.x authored by m4olivei
    Issue #2193833 by m4olivei: Errors when viewing a node with a...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.