Fixed Skip non-existent sitemap handler classes

Chris D

XenForo developer
Staff member
This is might be considered more of a suggestion but there is a small fix that has a potential to prevent issues in the future hence the bug report.

All Sitemap operations including the SitemapExclude option assumes that all handler classes will exist and be available, whereas that might not be true. If an add-on doesn't remove properly, or like me you're developing some new sitemaps, the existing code will give a fatal "Class name must be a valid object or a string" error.

The getSitemapContentTypes function could be changed to something like the below to prevent such errors halting sitemap generation or access to the sitemap exclude option page:

PHP:
if (!class_exists($class))
{
    continue;
}

$types[$type] = $class;

It's worth noting that most of the default content type handlers do some sort of check that the class exists, at least, before being used.
 
Last edited:
Back
Top Bottom