Fixed XF\Entity\ProfilePost::getLatestComments assumes addCommentsToProfilePosts always calls setLatestComments

Xon

Well-known member
Affected version
2.0.4
getLatestComments expects that addCommentsToProfilePosts will call setLatestComments. However, if there are no visible comments, then setLatestComments is not called resulting in;

Code:
ErrorException: [E_NOTICE] Undefined index: LatestComments
src/XF/Entity/ProfilePost.php:333

#0 src/XF/Entity/ProfilePost.php(333): XF::handlePhpError(8, '[E_NOTICE] Unde...', '/var/www/da...', 333, Array)
#1 src/XF/Mvc/Entity/Entity.php(142): XF\Entity\ProfilePost->getLatestComments()
#2 src/XF/Mvc/Entity/Entity.php(95): XF\Mvc\Entity\Entity->get('LatestComments')

Since LatestComments is accessed in templates, this error is suppressed. But will cause an issue for any add-on which attempts to use this API.
 
Back
Top Bottom