Please replace with:

/**
 * Implements hook_node_delete().
 */
function feeds_imagegrabber_node_delete($node) {
  if (isset($node->nid) && is_numeric($node->nid)) {
    db_delete('feeds_imagegrabber')
        ->condition('feed_nid', $node->nid)
        ->execute();
  }
}

The current implementation is broken and against documentation:

Do not use this function for INSERT, UPDATE, or DELETE queries. Those should be handled via db_insert(), db_update() and db_delete() respectively.

(https://api.drupal.org/api/drupal/includes%21database%21database.inc/fun...)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Anybody created an issue. See original summary.

ashwinsh’s picture

Assigned: Unassigned » ashwinsh
Status: Active » Needs review
FileSize
780 bytes

Hello Anybody,

Added a patch file for the same, please check it.

Thank you,

Chalk’s picture

Status: Needs review » Reviewed & tested by the community

I confirm that #2 solves the error during a node deletion - bug was reproduced at the Pantheon hosting (PHP 7). But at local environment (PHP 5.6) the error was not reproduced.

rooby’s picture

Title: Replace feeds_imagegrabber_node_delete » Argument 2 passed to db_query() must be of the type array, string given
Priority: Normal » Critical

For people searching, this issue causes this error message:

TypeError: Argument 2 passed to db_query() must be of the type array, string given, called in sites/all/modules/feeds_imagegrabber/feeds_imagegrabber.module on line 127 in db_query() (line 2401 of includes/database/database.inc).

  • rooby committed 28afd48 on 7.x-1.x authored by ashwinsh
    Issue #2748459 by ashwinsh, rooby: Fatal error on feed item delete:...
rooby’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for the patch.

This is committed, although I made the following minor changes:
* Removed the if condition around the delete, as it isn't necessary in this case.
* Fixed the indentation.

Status: Fixed » Closed (fixed)

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

Jee’s picture

nevermind