Fixed  "Moderation Queue" doesn't get rebuilt when key is missing in Data Registry

Shadab

Well-known member
If the "moderationCounts" key is missing from the data registry, it doesn't get rebuilt when _updateModeratorSessionCaches() is called in the abstract public controller. (executed on each page load)

In XenForo_Dependencies_Public::_handleCustomPreloadedData(), we have:
PHP:
XenForo_Application::set('moderationCounts', $data['moderationCounts']);
which sets the moderationCounts to null, in case the data is missing.
And in XenForo_ControllerPublic_Abstract::_updateModeratorSessionModerationCounts(), we have:
PHP:
		if (XenForo_Application::isRegistered('moderationCounts'))
which always returns true (because it seems it doesn't check for null values). This prevents the cache from being rebuilt. I believe this is a bug; even though I can't find any situation where this data registry key gets deleted (except when running a delete query manually).
 
The same logic seems to apply to report counts too. They'll now only be registered if they're arrays.
 
Top Bottom