Fixed Very minor: XF\Repository\Notice#rebuildNoticeLastResetCache fails to return a value

PaulB

Well-known member
Affected version
2.1.10 Patch 2
XF\App#initialize:
PHP:
$container['notices.lastReset'] = $this->fromRegistry('noticesLastReset',
   function(Container $c) { return $c['em']->getRepository('XF:Notice')->rebuildNoticeLastResetCache(); }
);


XF\Repository\Notice#rebuildNoticeLastResetCache:
PHP:
public function rebuildNoticeLastResetCache()
{
   \XF::registry()->set('noticesLastReset', 0);
}


XF\Pub\App#updateUserCaches:
PHP:
$sessionLastNoticeUpdate = intval($session->get('lastNoticeUpdate'));
$dbLastNoticeReset = $this->get('notices.lastReset');
$updateDismissed = ($dbLastNoticeReset > $sessionLastNoticeUpdate);


While this logic ends up working because the call to rebuildNoticeLastResetCache effectively results in null which gets coerced to 0, it deviates from the conventions elsewhere and looks like a mistake. It should explicitly return 0.
 
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.2.0 Beta 2).

Change log:
Return a value when rebuilding notice last reset cache
There may be a delay before changes are rolled out to the XenForo Community.
 
Back
Top Bottom