diff options
-rw-r--r-- | zend/exists.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/zend/exists.cpp b/zend/exists.cpp index b5bc64f..3add227 100644 --- a/zend/exists.cpp +++ b/zend/exists.cpp @@ -35,6 +35,14 @@ bool class_exists(const char *classname, size_t len, bool autoload) // should we autoload the class? if (autoload) { + // no auto-load + if (SUCCESS != zend_lookup_class(classname, len, &ce TSRMLS_CC)) return false; + + // the found "class" could also be an interface or trait, which we do no want + return ((*ce)->ce_flags & (ZEND_ACC_INTERFACE | (ZEND_ACC_TRAIT - ZEND_ACC_EXPLICIT_ABSTRACT_CLASS))) == 0; + } + else + { // starting slashes can be ignored if (len > 0 && classname[0] == '\\') { classname++; len--; } @@ -52,14 +60,6 @@ bool class_exists(const char *classname, size_t len, bool autoload) // the found "class" could also be an interface or trait, which we do no want return !(((*ce)->ce_flags & (ZEND_ACC_INTERFACE | ZEND_ACC_TRAIT)) > ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); } - else - { - // no auto-load - if (SUCCESS != zend_lookup_class(classname, len, &ce TSRMLS_CC)) return false; - - // the found "class" could also be an interface or trait, which we do no want - return ((*ce)->ce_flags & (ZEND_ACC_INTERFACE | (ZEND_ACC_TRAIT - ZEND_ACC_EXPLICIT_ABSTRACT_CLASS))) == 0; - } } /** |