With the crumbs module (and possibly others that examine the active path) enabled

admin/structure/nodequeue/add/smartqueue_taxonomy gives this error:

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 1: SELECT qid, use_parents FROM {smartqueue} WHERE qid IN (); Array ( ) in smartqueue_nodequeue_alter() (line 175 of /Users/phildodd/Sites/2gb-shop/sites/all/modules/nodequeue/smartqueue.module).

CommentFileSizeAuthor
#9 smartqueue-PDOException-1850244-9.patch898 bytesr-mo
#2 smartqueue.module.1850244.patch875 bytesAnonymous (not verified)

Comments

tripper54’s picture

It seems smartqueue_nodequeue_alter is being called with an empty $data array, which breaks the query on line 175.
Wrapping the switch in if (!empty($data)) seems to stop the error.
I'll keep playing with it and submit a patch if it seems OK.

Anonymous’s picture

Priority: Normal » Critical
StatusFileSize
new875 bytes

I have encountered the same problem with the latest dev version (2012-Jan-25).
Please check the attached patch

bohemier’s picture

@CompuBase, Thanks that saved me!

gaele’s picture

gaele’s picture

Status: Active » Reviewed & tested by the community

Yup, this works.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, smartqueue.module.1850244.patch, failed testing.

gaele’s picture

Status: Needs work » Needs review

Hmm, applied cleanly here to 2.x

tripper54’s picture

Status: Needs review » Reviewed & tested by the community

Applied cleanly 2.x for me, and fixed the issue.

r-mo’s picture

Issue summary: View changes
StatusFileSize
new898 bytes

Same fix, should pass automated testing (hopefully).

fizk’s picture

I can't replicate this. Does this issue still effect anyone?

fizk’s picture

Status: Reviewed & tested by the community » Postponed (maintainer needs more info)
tripper54’s picture

Status: Postponed (maintainer needs more info) » Reviewed & tested by the community

Problem still exists in 7.x-2.x-dev . The patch sill applies cleanly and fixes the problem!

fizk’s picture

@tripper54 What are the exact steps to reproduce?

tripper54’s picture

OK, I did a bit of digging into this. In the case of my site there is a conflict with the crumbs module.

Steps to reproduce:

1. download and enable crumbs https://www.drupal.org/project/crumbs
2. download nodequeue and enable smartqueue.
3. go to /admin/structure/nodequeue/add/smartqueue_taxonomy

Note the crumbs module is included in Commerce Kickstart. This is how it found its way into my site.

Without digging into the crumbs project too much, this is what I was able to work out:

The crumbs module pulls apart the active path and calls the relevant menu handlers to contruct breadcrumbs. So when it tries to generate crumbs for
/admin/structure/nodequeue/add/smartqueue_taxonomy

it calls the handler for /admin/structure/nodequeue/add , which means nodequeue_load is called with "add" as the $qid argument. This is a junk argument, and breaks things from here on in.

No problem is caused in nodequeue_load_queues, it just returns an empty array. It then calls

drupal_alter('nodequeue', $loaded, $context);

With loaded as an empty array. This breaks smartqueue_nodequeue_alter.

I guess crumbs is kinda dumb, but there should be some sanity check to prevent a bad function call breaking things.

Whether this should happen in nodequeue_load_queues , ie

    if(!empty($loaded)) {
      drupal_alter('nodequeue', $loaded, $context);
    }

or in smartqueue_nodequeue_alter as per the patch, is up to you. I guess it depends on whether there ever is a case for calling those alter functions on an empty result.

Maybe both?

Note in the 3.x branch this bug was fixed in a slightly different way, using count() to make sure there are some qids to check, see #1580380: Unable to add nodequeue with Smartqueue sub module enabled

  • fizk committed fe79e76 on 7.x-2.x authored by joep.hendrix
    Issue #1850244 by joep.hendrix, r-mo, tripper54, gaele, fizk, bohemier:...
fizk’s picture

Status: Reviewed & tested by the community » Fixed

Excellent. Committed, thanks!

Status: Fixed » Closed (fixed)

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