Fixed News feed handler does not check if the content exists before adding attachments

Affected version


Well-known member
Calling getContent() on XF:NewsFeed entity will throw this exception
ErrorException: [E_WARNING] Invalid argument supplied for foreach() src/XF/Repository/Attachment.php:198
if the content does not exist.


Well-known member
Method addAttachments in news feed handler also passes entity to \XF\Repository\Attachment::addAttachmentsToContent without turning entity into array collection and back to entity.

XF Bug Bot

XenForo bug fixer bot
Staff member
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.1.8).

Change log:
Improve news feed handler attachment handling
There may be a delay before changes are rolled out to the XenForo Community.