Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When creating a node I was running into PHP notices on lines 40 and 45 of theme/theme.inc:
Undefined index: uri in template_preprocess_galleria_container()
A patch is provided with some defensive code if there is no uri field available. This seems to do the trick.
Comment | File | Size | Author |
---|---|---|---|
galleria_fix_missing_uri.patch | 607 bytes | murrayw |
Comments
Comment #1
kroimon CreditAttribution: kroimon commentedThanks for the patch!
How exactly did you run into these notices? I tried creating a new node with a Galleria-styled image field, but never got any errors...
Comment #2
miro_dietikerI see 2 issues to check
- adding a field after already nodes exist, displaying those nodes
- adding a non-required image field, creating a node without uploading an image, displaying it
Comment #3
kroimon CreditAttribution: kroimon commentedIn both cases, the $items array should be empty, so the foreach loop should never run.
I asked how to reproduce the bug to see what elements in the items array have no uri field.
Comment #4
murrayw CreditAttribution: murrayw commentedI never actually saw the error myself but it was reported by a user. The steps they took to generate it were:
- create a new galleria node
- upload multiple images
- click save
The user reported that only the first image was saved. Looks like there might have been some problem with saving the images leading to the image not having a full uri. So not sure how it happened but we did have images with no uri.
Comment #5
kroimon CreditAttribution: kroimon commentedOk, I don't exactly know how this could happen but I just committed your patch which should appear in the next -dev build.
Marking this as being fixed for now, might be reopened once we find the actual cause :-)