I started getting the following errors multiple times on every page whether it was using Flickr photos or not:
Notice: Undefined offset: 0 in theme_flickr_photo() (line 686 of /home/anaheime/public_html/sites/all/modules/flickr/flickr.module).
Notice: Trying to get property of non-object in theme_flickr_photo() (line 686 of /home/anaheime/public_html/sites/all/modules/flickr/flickr.module).
Notice: Undefined offset: 0 in theme_flickr_photo() (line 689 of /home/anaheime/public_html/sites/all/modules/flickr/flickr.module).
Notice: Trying to get property of non-object in theme_flickr_photo() (line 689 of /home/anaheime/public_html/sites/all/modules/flickr/flickr.module).
Warning: end() expects parameter 1 to be array, null given in theme_flickr_photo() (line 690 of

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

wzain created an issue. See original summary.

lolandese’s picture

Status: Active » Postponed (maintainer needs more info)

I need to know some of your settings. Please send me a screenshot of admin/config/media/flickr with both the GLOBAL and ADVANCED section in uncollapsed state.

Thanks.

wzain’s picture

FileSize
211.27 KB
289.73 KB
221.07 KB

Hi
Here are the settings you requested. Thanks for looking into it.
Please see attachments.

lolandese’s picture

To hide these messages from your visitors, at admin/config/development/logging start by setting Error messages to display to None. This is the usual setting for Production. I agree that it should be solved but debugging usually takes place in Development (where you do show these messages).

wzain’s picture

I changed the settings as recommended.
I am not sure I understand your answer. Are you saying this is a known bug that you are working on?

lolandese’s picture

Status: Postponed (maintainer needs more info) » Active
Issue tags: -undefined offset 0

It's just a quick "fix" for the "symptoms". The cause needs still to be looked into.

It depends on a certain combination of using Google instead of Flickr for location info (reverse geocoding) and the connection method (cURL, fopen).

Your report made me aware of the issue. Thanks for that. I will try to replicate it first at https://simplytest.me/project/flickr/7.x-1.x.

wzain’s picture

Hi. Any updates on this issue? I am still getting a lot of those errors in the log and they are slowing the site down.

lolandese’s picture

Version: 7.x-1.8 » 7.x-1.x-dev
Status: Active » Needs review
FileSize
1.48 KB

Apologies for the late fix.

lolandese’s picture

Status: Needs review » Needs work
Related issues: +#3134599: To use maps.googleapis.com/maps/api/geocode now an API key is required

Mmm. It seems instead it has to do with #3134599: To use maps.googleapis.com/maps/api/geocode now an API key is required.

There is a better way by checking for the response status and use a conditional like:

if ($json->status == 'ZERO_RESULTS' || $json->status == 'REQUEST_DENIED')

That takes care of the errors. We then still need to set a Google API key to make an authorized API call, as for the above-mentioned feature request.

lolandese’s picture

Status: Needs work » Closed (duplicate)
Related issues: +#3134578: Several PHP notices: undefined offset, trying to get property of non-object

As there was another occurrence of the pain-causing Google API call, a different patch has been provided there that fixes the issue here in a better way. Go there and review: #3134578: Several PHP notices: undefined offset, trying to get property of non-object

Closing this one as a duplicate, despite this being the older issue (sorry).