From: Michael Vogel Date: Mon, 21 Jul 2014 22:33:48 +0000 (+0200) Subject: API: Bugfix for an API result where "in reply to" was equal to the id of the post. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=f920fa229b2538a117bea8aa49c57b61ed71658a;p=friendica.git API: Bugfix for an API result where "in reply to" was equal to the id of the post. --- diff --git a/include/api.php b/include/api.php index d61cc3d4aa..b10c2bf496 100644 --- a/include/api.php +++ b/include/api.php @@ -769,7 +769,7 @@ $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']); @@ -784,6 +784,18 @@ } } + // 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,