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

XenForo_Application::autoload vs class_exists

Discussion in 'XenForo Development Discussions' started by Shadab, Mar 9, 2011.

  1. Shadab

    Shadab Well-Known Member

    What's the rationale behind using XenForo_Application::autoload() to check if a given class is autoload-able, instead of using a much simpler class_exists('', true) function?

    It creates an additional (and unnecessary) dependency on the XenForo_Autoloader class.
    Sniper likes this.
  2. Shadab

    Shadab Well-Known Member

    Kier? Mike? :whistle:
  3. Mike

    Mike XenForo Developer Staff Member

    Not really sure actually - probably forgot about class_exists at the time? :)
    Liam W and Vladislav Rastrusny like this.
  4. Shadab

    Shadab Well-Known Member

    Thanks for the reply, Mike. :)

    Would it be possible to remove this particular dependency on the autoloader? Please?

    As it stands, the XF autoloader doesn't support loading of namespaced classes and multiple library directories. This issue can be easily solved by using a custom autoloader. The real problem arises when trying to use those classes. Pretty much any handler class and every class that utilizes the dynamic proxy system cannot be loaded from any other autoloader due to this hard dependency.
    Vladislav Rastrusny likes this.
  5. Vladislav Rastrusny

    Vladislav Rastrusny Active Member

Share This Page