• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Fixed xf_user_news_feed_cache contains invalid data when an add-on is disabled.

Chris D

XenForo developer
Staff member
#1
As title, there is a problem with the data stored in a user's news feed cache after an add-on has been disabled.

This potentially affects all add-ons, including the Resource Manager.

If a user's news feed cache contains news feed items created by an add-on, and the add-on is subsequently disabled, the following error is logged in the Server Error Log (when a user goes to their Your News Feed page)

ErrorException: Undefined index: resource_update - library/XenForo/ViewPublic/Helper/NewsFeed.php:30
Code:
Stack Trace
#0 /Users/chrisdeeming/Documents/xenforo/library/XenForo/ViewPublic/Helper/NewsFeed.php(30): XenForo_Application::handlePhpError(8, 'Undefined index...', '/Users/chrisdee...', 30, Array)
#1 /Users/chrisdeeming/Documents/xenforo/library/XenForo/ViewPublic/NewsFeed/View.php(11): XenForo_ViewPublic_Helper_NewsFeed::getTemplates(Object(XenForo_ViewPublic_NewsFeed_View), Array, Array)
#2 /Users/chrisdeeming/Documents/xenforo/library/XenForo/ViewRenderer/Abstract.php(227): XenForo_ViewPublic_NewsFeed_View->renderHtml()
#3 /Users/chrisdeeming/Documents/xenforo/library/XenForo/ViewRenderer/HtmlPublic.php(67): XenForo_ViewRenderer_Abstract->renderViewObject('XenForo_ViewPub...', 'Html', Array, 'news_feed_page')
#4 /Users/chrisdeeming/Documents/xenforo/library/XenForo/ViewRenderer/Abstract.php(249): XenForo_ViewRenderer_HtmlPublic->renderView('XenForo_ViewPub...', Array, 'news_feed_page', NULL)
#5 /Users/chrisdeeming/Documents/xenforo/library/XenForo/ViewRenderer/HtmlPublic.php(64): XenForo_ViewRenderer_Abstract->renderSubView(Object(XenForo_ControllerResponse_View))
#6 /Users/chrisdeeming/Documents/xenforo/library/XenForo/FrontController.php(572): XenForo_ViewRenderer_HtmlPublic->renderView('XenForo_ViewPub...', Array, 'account_wrapper', Object(XenForo_ControllerResponse_View))
#7 /Users/chrisdeeming/Documents/xenforo/library/XenForo/FrontController.php(158): XenForo_FrontController->renderView(Object(XenForo_ControllerResponse_View), Object(XenForo_ViewRenderer_HtmlPublic), Array)
#8 /Users/chrisdeeming/Documents/xenforo/index.php(13): XenForo_FrontController->run()
#9 {main}
Request State
array(3) {
  ["url"] => string(44) "http://localhost/index.php?account/news-feed"
  ["_GET"] => array(1) {
    ["account/news-feed"] => string(0) ""
  }
  ["_POST"] => array(0) {
  }
}
On my server (but not locally, for some reason) additionally this error:

ErrorException: Fatal Error: Call to a member function renderHtml() on a non-object -library/XenForo/ViewPublic/Helper/NewsFeed.php:32
Code:
Stack Trace
#0 [internal function]: XenForo_Application::handleFatalError()
#1 {main}
Request State
array(3) {
  ["url"] => string(44) "http://xenmediagallery.com/account/news-feed"
  ["_GET"] => array(1) {
    ["/account/news-feed"] => string(0) ""
  }
  ["_POST"] => array(0) {
  }
}

I have fixed this on my dev install very easily by checking if the index isset or continuing and further checking in the template if {$item.template} exists.

EDIT: Just to clarify: Recent Activity is not affected by the same issue.