PaulB
Well-known member
- Affected version
- 2.1.10 Patch 2
XF\App#initialize:
XF\Repository\Notice#rebuildNoticeLastResetCache:
XF\Pub\App#updateUserCaches:
While this logic ends up working because the call to
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
.