The patch added for
PHPBB3-14559 only fixes the single case where someone uses the quote-reply button to quote a post containing an inline attachment. It does not fix:
- Posts which add a quote containing an inline attachment by using the quote button in the message history in the editor
- Posts which were already created before the patch which contained an attachment tag inside of a quote tag
- Any other scenario where a user manually copies and pastes BBCode containing attachment tags
A more correct solution for this problem is to associate the nested attachment tag with the post ID on the parent [quote] tag, if one exists, and load attachment data that way using a (post_id, index) composite key. (Using indexes for attachments is pretty much always wrong since they aren’t unique or immutable, unlike attach_id, but whatever.)
A less good alternative—which would be needed anyway for quotes which don’t include the original post ID—is for the template for <ATTACHMENT> to look in the ancestor axis for a <QUOTE> element, and if there is one, don’t output the comment hack which is used to process and replace the inline attachment at render time.