On a fresh install openning newly created gallery's sort page (http://mysite.com/node/21/sort) gives error message:

warning: array_fill() [function.array-fill]: Number of elements must be positive in /usr/drupal/includes/database.inc on line 253.
warning: implode() [function.implode]: Invalid arguments passed in /usr/drupal/includes/database.inc on line 253.
user warning: 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 query: SELECT n.nid,n.title,n.status,n.created,n.changed,f.filepath,ngi.weight FROM node n INNER JOIN node_revisions r ON r.vid = n.vid INNER JOIN content_type_node_gallery_image cck ON cck.nid = n.nid INNER JOIN files f ON f.fid = cck.field_node_gallery_image_fid INNER JOIN node_gallery_images ngi ON ngi.nid = n.nid WHERE n.nid IN () in /usr/drupal/sites/all/modules/node_gallery/node_gallery.inc on line 370.
CommentFileSizeAuthor
#1 ng3-get-images-quickfix2.patch916 bytesscroogie
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

scroogie’s picture

Assigned: Unassigned » scroogie
Status: Active » Needs review
FileSize
916 bytes

Thanks for reporting. My fault. Here is the fix.

justintime’s picture

Status: Needs review » Fixed

Committed to dev for inclusion in alpha2. If you're a user running into this bug on alpha1, note you don't need to upgrade to dev, just add an image to the gallery and the sort page will work.

@scroogie, I modified your code a bit so that we return an empty array instead of NULL.

parasox’s picture

Was about to report the same (similar?) thing.. My error code is slightly different, so figured I should post it here.

Warning: array_fill() [<a href='function.array-fill'>function.array-fill</a>]: Number of elements must be positive in db_placeholders() (line 276 of /var/www/includes/database.inc).
Warning: implode() [<a href='function.implode'>function.implode</a>]: Invalid arguments passed in db_placeholders() (line 276 of /var/www/includes/database.inc).
User warning: 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 &#039;)&#039; at line 1 query: SELECT n.nid,n.title,n.status,n.created,n.changed,f.filepath,ngi.weight FROM node n INNER JOIN node_revisions r ON r.vid = n.vid INNER JOIN content_type_node_gallery_image cck ON cck.nid = n.nid INNER JOIN files f ON f.fid = cck.field_node_gallery_image_fid INNER JOIN node_gallery_images ngi ON ngi.nid = n.nid WHERE n.nid IN () in _db_query() (line 141 of /var/www/includes/database.mysqli.inc).
justintime’s picture

Thanks @parasox - it's the same bug with the same fix and workaround. This was on an empty gallery, correct?

parasox’s picture

Yeap, just if you click sort when there are no images.

Status: Fixed » Closed (fixed)

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