Hello,
Great module, thanks for it. Using 7.x-1.1. I found while using it that we would get the occasional streak of errors like this:
Notice: Trying to get property of non-object in instagram_block_block_view() (line 131 of sites/all/modules/instagram_block/instagram_block.module)
Warning: Invalid argument supplied for foreach() in instragram_block_block_view() (line 131 of sites/all/modules/instagram_block/instagram_block.module)
Taking a look at the code, it seems that bad Instagram credentials (username, token, etc.) or a non-responsive Instagram can cause the response back from Instagram to be something other than expected. Rather than error out, I've attached a patch that will ensure an expected response.
Thanks,
Matt
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | protect_against_an-2259207-6.patch | 929 bytes | yanniboi |
| #3 | error.png | 41.95 KB | joelpittet |
| #2 | patch_protect_against-2259207-2.patch | 486 bytes | joelpittet |
| check_for_content_from_instagram.patch | 3 KB | m4olivei |
Comments
Comment #1
yanniboi commentedThe module has moved on since this patch has been posted. It might need rerolling, but I think that this bug has been fixed anyway...
Comment #2
joelpittetOn thing this patch could do is avoid rethrowing the exception and fail to watchdog.
I'd rather see nothing on a block than throwing a big red error to the user when the host goes down or times out which seems to happen often enough for me to see it in the watchdog.
Comment #3
joelpittetExample error message, by faking the URL:
Comment #4
thijsvdanker commentedPatch applies cleanly, and it makes a lot of sense not having your entire site fail over an instagram block :)
rtbc!
Comment #5
jacmkno commentedRelated issue being addressed here: https://www.drupal.org/node/2428913#comment-9659213
Comment #6
yanniboi commentedI've updated the patch. What you posted is good, but I also added swapped a watchdog exception for a watchdog in the request call.
Will be committing this shortly.
Comment #8
jcalais commentedI could not get @yanniboi 's patch to work, because it referenced the lib.php -file that in our case didn't contain the code mentioned in the patch (no mention of Watchdog at all in our file).
The second newest patch by @joelpittet did apply correctly.
Comment #9
yanniboi commentedMy patch has been committed and pushed to 7.x-1.x-dev.
Comment #11
don greco commentedI have a site in a hosting environment and I can not apply patches.
I made a demo site a year ago for a client and they are now looking to see it and I cannot log into it to take it out of maintenance mode because of this error.
Does anyone have any insight ?
this is what I am getting:
Comment #12
joelpittetUpload the latest release to your site. It should resolve this issue for you.