]> git.mxchange.org Git - friendica.git/commitdiff
API: Bugfix for an API result where "in reply to" was equal to the id of the post.
authorMichael Vogel <icarus@dabo.de>
Mon, 21 Jul 2014 22:33:48 +0000 (00:33 +0200)
committerMichael Vogel <icarus@dabo.de>
Mon, 21 Jul 2014 22:33:48 +0000 (00:33 +0200)
include/api.php

index d61cc3d4aacd6a4dfcb50f328dcb3ae852c0008e..b10c2bf4964d4d6c2191367f9d7808b66d3a4928 100644 (file)
                        $in_reply_to_status_id_str = NULL;
                        $in_reply_to_user_id_str = NULL;
                        $in_reply_to_screen_name = NULL;
-                       if ($lastwall['parent']!=$lastwall['id']) {
+                       if (intval($lastwall['parent']) != intval($lastwall['id'])) {
                                $in_reply_to_status_id= intval($lastwall['parent']);
                                $in_reply_to_status_id_str = (string) intval($lastwall['parent']);
 
                                }
                        }
 
+                       // There seems to be situation, where both fields are identical:
+                       // https://github.com/friendica/friendica/issues/1010
+                       // This is a bugfix for that.
+                       if (intval($in_reply_to_status_id) == intval($lastwall['id'])) {
+                               logger('api_status_show: this message should never appear: id: '.$lastwall['id'].' similar to reply-to: '.$in_reply_to_status_id, LOGGER_DEBUG);
+                               $in_reply_to_status_id = NULL;
+                               $in_reply_to_user_id = NULL;
+                               $in_reply_to_status_id_str = NULL;
+                               $in_reply_to_user_id_str = NULL;
+                               $in_reply_to_screen_name = NULL;
+                       }
+
                        $status_info = array(
                                'text' => trim(html2plain(bbcode(api_clean_plain_items($lastwall['body']), false, false, 2, true), 0)),
                                'truncated' => false,