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
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | throwing_errors_for-2743421-2.patch | 822 bytes | joelpittet |
Comments
Comment #2
joelpittetPatched proposed by @yanniboi
Comment #3
sergiivelykodnyi commentedThis patch work for me.
Comment #4
joelpittetComment #5
kareemzok commentedThe patch in comment #2 work for me.
Thanks
Comment #6
wavesailor commentedPatch worked for me too
Comment #7
rob230 commentedPatch #2 worked for me.
Comment #8
shaneod commentedPatch also worked for me - nice work lads!
Comment #9
joelpittetSet the status to "Reviewed and Tested by the Community" aka RTBC if you've tested the patch and it works.
Comment #11
yanniboi commentedThanks peeps!