diff options
-rw-r--r-- | include/call.h | 8 | ||||
-rw-r--r-- | zend/exists.cpp | 6 |
2 files changed, 7 insertions, 7 deletions
diff --git a/include/call.h b/include/call.h index 80ef6c9..e1bb12d 100644 --- a/include/call.h +++ b/include/call.h @@ -15,10 +15,10 @@ namespace Php { /** * List of functions that are available for use in PHP */ -bool class_exists(const char *classname, size_t size, bool autoload = true); -bool class_exists(const char *classname, bool autoload = true) { return class_exists(classname, strlen(classname), autoload); } -bool class_exists(const std::string &classname, bool autoload = true) { return class_exists(classname.c_str(), classname.size(), autoload); } -Value eval(const std::string &phpCode); +extern bool class_exists(const char *classname, size_t size, bool autoload = true); +inline bool class_exists(const char *classname, bool autoload = true) { return class_exists(classname, strlen(classname), autoload); } +inline bool class_exists(const std::string &classname, bool autoload = true) { return class_exists(classname.c_str(), classname.size(), autoload); } +extern Value eval(const std::string &phpCode); /** * Call a function in PHP diff --git a/zend/exists.cpp b/zend/exists.cpp index 6bab8ba..b5bc64f 100644 --- a/zend/exists.cpp +++ b/zend/exists.cpp @@ -44,10 +44,10 @@ bool class_exists(const char *classname, size_t len, bool autoload) std::unique_ptr<char[]> lc_name(new char[len + 1]); // copy the name to lowercase, but ignore the starting slash (if there is one) - zend_str_tolower_copy(lc_name, classname, len); + zend_str_tolower_copy(lc_name.get(), classname, len); // see if there is a class with this name - if (SUCCESS != zend_hash_find(EG(class_table), name, len + 1, (void **) &ce)) return false; + if (SUCCESS != zend_hash_find(EG(class_table), lc_name.get(), len + 1, (void **) &ce)) 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); @@ -55,7 +55,7 @@ bool class_exists(const char *classname, size_t len, bool autoload) else { // no auto-load - if (SUCCESS != zend_lookup_class(str, len, &ce TSRMLS_CC) == SUCCESS) return false; + 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; |