Problem/Motivation

Follow-up to #2724233: Block completly broken after instagram update.

From #2724233-16: Block completly broken after instagram update.

Notice: Undefined property: stdClass::$data in InstagramPost->__construct() (line 250 of /instagram_block.lib.php).
Warning: Invalid argument supplied for foreach() in InstagramPost->get_likes() (line 273 of /instagram_block.lib.php).
Notice: Undefined property: stdClass::$data in InstagramPost->__construct() (line 250 of /instagram_block.lib.php).
Warning: Invalid argument supplied for foreach() in InstagramPost->get_likes() (line 273 of /instagram_block.lib.php).

Proposed resolution

#2724233-28: Block completly broken after instagram update.


-    if ($instagram_post->comments->count) {
+    if ($instagram_post->comments->count && !empty($instagram_post->comments->data)) {
       $this->comment_count = $instagram_post->comments->count;
       $this->comments = $this->get_comments($instagram_post->comments->data);
     }
 
-    if ($instagram_post->likes->count) {
+    if ($instagram_post->likes->count && !empty($instagram_post->likes->data)) {
       $this->like_count = $instagram_post->likes->count;
       $this->likes = $this->get_likes($instagram_post->likes->data);
     }

Remaining tasks

CommentFileSizeAuthor
#2 throwing_errors_for-2743421-2.patch822 bytesjoelpittet

Comments

joelpittet created an issue. See original summary.

joelpittet’s picture

StatusFileSize
new822 bytes

Patched proposed by @yanniboi

sergiivelykodnyi’s picture

This patch work for me.

joelpittet’s picture

Status: Active » Needs review
kareemzok’s picture

The patch in comment #2 work for me.
Thanks

wavesailor’s picture

Patch worked for me too

rob230’s picture

Patch #2 worked for me.

shaneod’s picture

Patch also worked for me - nice work lads!

joelpittet’s picture

Set the status to "Reviewed and Tested by the Community" aka RTBC if you've tested the patch and it works.

  • yanniboi committed 0a1c901 on 7.x-1.x authored by joelpittet
    Issue #2743421 by joelpittet: Throwing errors for comments and likes...
yanniboi’s picture

Status: Needs review » Fixed

Thanks peeps!

Status: Fixed » Closed (fixed)

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