diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html
index a84265329a..2371b5e2df 100644
--- a/phpBB/docs/CHANGELOG.html
+++ b/phpBB/docs/CHANGELOG.html
@@ -174,7 +174,7 @@
[Fix] Banning an already banned user states to be successful, but has no effect (Bug #47825 - Patch by Pyramide)
[Fix] Do not add style-parameter to URL again, after admin re-authentification (Bug #18005 - Patch by leviatan21)
[Fix] Do not cut post-message in between HTML-Entities on search.php (Bug #31505 - Patch by leviatan21)
- [Fix] Correctly set attachment flag for topics, posts and pms after deleting attachments (Bug #48265 - Patch by WorldWar and nickvergessen)
+ [Fix] Correctly set attachment flag for topics, posts and pms after deleting attachments (Bug #48265 - Patch by MarcoDM and nickvergessen)
[Fix] Display "Locked" button instead of "Reply" one for locked forum in viewtopic (prosilver). (Bug #38055 - Patch by Raimon)
[Fix] Correctly propagate umlauts over search result pages (Bug #33755)
[Fix] Preserve post options when refusing to save the post as a draft. (Bug #39115)
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index e348694cfe..543472ad4e 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -1553,8 +1553,8 @@ function delete_post($forum_id, $topic_id, $post_id, &$data)
{
$sql = 'SELECT 1 AS has_attachments
FROM ' . ATTACHMENTS_TABLE . '
- WHERE ' . $db->sql_in_set('topic_id', $topic_ids);
- $result = $db->sql_query($sql);
+ WHERE topic_id = ' . $topic_id;
+ $result = $db->sql_query_limit($sql, 1);
$has_attachments = (int) $db->sql_fetchfield('has_attachments');
$db->sql_freeresult($result);