]> git.mxchange.org Git - friendica-addons.git/commitdiff
[tumblr] Ward against unexpected response format in tumblr_fetch_tags()
authorHypolite Petovan <hypolite@mrpetovan.com>
Fri, 7 Feb 2025 01:50:40 +0000 (20:50 -0500)
committerTobias Diekershoff <tobias@noreply.git.friendi.ca>
Sat, 8 Feb 2025 15:57:13 +0000 (16:57 +0100)
- Adress https://github.com/friendica/friendica/issues/14646#issuecomment-2628090487

tumblr/tumblr.php

index 819c0ca5c4100e6fb9ca00343343020a81d651d3..f2e2d78d8641512242b8ace9e92ee834f6032e91 100644 (file)
@@ -743,6 +743,12 @@ function tumblr_fetch_tags(int $uid, int $last_poll)
 
        foreach (DI::pConfig()->get($uid, 'tumblr', 'tags') ?? [] as $tag) {
                $data = tumblr_get($uid, 'tagged', ['tag' => $tag]);
+
+               if (!is_array($data->response)) {
+                       DI::logger()->warning('Unexpected Tumblr response format', ['uid' => $uid, 'url' => 'tagged', 'parameters' => ['tag' => $tag], 'data' => $data]);
+                       continue;
+               }
+
                foreach (array_reverse($data->response) as $post) {
                        $id = tumblr_process_post($post, $uid, Item::PR_TAG, $last_poll);
                        if (!empty($id)) {