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).
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | smartqueue-PDOException-1850244-9.patch | 898 bytes | r-mo |
| #2 | smartqueue.module.1850244.patch | 875 bytes | Anonymous (not verified) |
Comments
Comment #1
tripper54 commentedIt 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.
Comment #2
Anonymous (not verified) commentedI have encountered the same problem with the latest dev version (2012-Jan-25).
Please check the attached patch
Comment #3
bohemier commented@CompuBase, Thanks that saved me!
Comment #4
gaele commentedSame bug has already been fixed in 3.x: #1580380: Unable to add nodequeue with Smartqueue sub module enabled
Comment #5
gaele commentedYup, this works.
Comment #7
gaele commentedHmm, applied cleanly here to 2.x
Comment #8
tripper54 commentedApplied cleanly 2.x for me, and fixed the issue.
Comment #9
r-mo commentedSame fix, should pass automated testing (hopefully).
Comment #10
fizk commentedI can't replicate this. Does this issue still effect anyone?
Comment #11
fizk commentedComment #12
tripper54 commentedProblem still exists in 7.x-2.x-dev . The patch sill applies cleanly and fixes the problem!
Comment #13
fizk commented@tripper54 What are the exact steps to reproduce?
Comment #14
tripper54 commentedOK, 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
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
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
Comment #16
fizk commentedExcellent. Committed, thanks!