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

Fixed Skip non-existent sitemap handler classes

Discussion in 'Resolved Bug Reports' started by Chris D, Sep 12, 2014.

  1. Chris D

    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: Sep 12, 2014
  2. Mike

    Mike XenForo Developer Staff Member

    Reasonable change. (y)
     
    Chris D likes this.

Share This Page