Don't throw PhutilMissingSymbolException from class_exists or interface_exists
Summary:
Fixes T1116. Currently we throw a PhutilMissingSymbolException from the libphutil autoloader function (__phutil_autoload) if the following criteria are met:
- The class/interface being loaded does not exist.
- __phutil_autoload is the last registered autoloader.
This causes problems with some third-party code which does class_exists($some_class) where $some_class doesn't exist. This function causes the autoloader to be invoked, which thus throws PhutilMissingSymbolException. This is clearly undesirable and, as such, a rather hacky fix is to inspect the output of debug_backtrace() and look for a call to class_exists, interface_exists or trait_exists anywhere in the stacktrace. If any of these functions are found in the stacktrace, we simply return false instead of throwing a PhutilMissingSymbolException.
Test Plan: Ran ./scripts_update_compat_info.php without error.
Reviewers: Blessed Reviewers, epriestley
Reviewed By: Blessed Reviewers, epriestley
Subscribers: Korvin
Maniphest Tasks: T1116
Differential Revision: https://secure.phabricator.com/D14523