I've been seeing this error in the logs on a live site I manage for a while now and finally had a chance to do a little testing this weekend. On a fresh local install of Drupal 7.34 and Node gallery 1.x I'm able to reproduce. The errors look like this in the log:

  • Notice: Undefined index: 108 in node_gallery_api_get_item_position() (line 825 of /sites/all/modules/node_gallery/node_gallery_api.inc).
  • Notice: Undefined index: 108 in node_gallery_api_get_item_position() (line 825 of /sites/all/modules/node_gallery/node_gallery_api.inc).
  • Notice: Undefined index: 108 in node_gallery_api_get_item_position() (line 825 of /sites/all/modules/node_gallery/node_gallery_api.inc).

I didn't notice these errors until I added a larger gallery (200+ items); not sure if it's related.

The only configuration I've done for Node Gallery is to enable colorbox by adding colorbox support by adding colorbox as a display at: file-types/manage/image/file-display/node_gallery_file_thumbnail

What can I do to provide more useful information?

Comments

RavindraSingh’s picture

Status: Active » Postponed (maintainer needs more info)

Can you please update your module to the latest release. 7.x-1.1. I have checked its not their anymore.

zengenuity’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)
dave bruns’s picture

Status: Closed (fixed) » Active

I had a little time yesterday to look into this again while running site updates (joy...)

I installed 7.x-1.1 on a live server that was throwing the error frequently, but it didn't help. Same error in the logs, and I could reproduce at will by clicking any image on page 2+ of the pager, when viewing the gallery. (The "Image Thumbnail Grid" display).

Then I noticed this comment in a related issue: https://www.drupal.org/node/1880524#comment-9504367

I checked the view (node_gallery_gallery_item_views) and, sure enough, the "Image Sort" display is limited to 24 items. It is configured to use a pager, but I've never seen the pager when sorting (didn't investigate why).

When I disabled the pager (Display all items) for the "Image Sort" display only, this fixed the problem on two servers I tested. It wasn't necessary for me to sort, or reset the sort.

Note that this problem will only appear with larger galleries with more than 24 items.

I've re-opened this issue for now. If you want me to file a new issue please let me know.

zengenuity’s picture

Status: Active » Closed (cannot reproduce)

I just committed a change for #1880524: PHP Notice Undefined index: in node_gallery_api_get_item_position() line 832 which may fix this issue. I'm not sure. I've never been able to reproduce it.