Instead of a single boolean, so we have space for extension here.
*strict_class = 1;
ret = 1;
}
- } else if ((ce = zend_lookup_class_ex(name, NULL, 1)) != NULL) {
+ } else if ((ce = zend_lookup_class(name)) != NULL) {
zend_class_entry *scope;
zend_execute_data *ex = EG(current_execute_data);
if (!only_subclass && EXPECTED(zend_string_equals(instance_ce->name, class_name))) {
retval = 1;
} else {
- ce = zend_lookup_class_ex(class_name, NULL, 0);
+ ce = zend_lookup_class_ex(class_name, NULL, ZEND_FETCH_CLASS_NO_AUTOLOAD);
if (!ce) {
retval = 0;
} else {
return;
}
- ce = zend_lookup_class_ex(class_name, NULL, autoload);
+ ce = zend_lookup_class_ex(class_name, NULL, !autoload ? ZEND_FETCH_CLASS_NO_AUTOLOAD : 0);
if (ce) {
if (ce->type == ZEND_USER_CLASS) {
zend_string *class_name = zval_get_tmp_string(scope_arg, &tmp_class_name);
if (zend_string_equals_literal(class_name, "static")) {
ce = closure->func.common.scope;
- } else if ((ce = zend_lookup_class_ex(class_name, NULL, 1)) == NULL) {
+ } else if ((ce = zend_lookup_class(class_name)) == NULL) {
zend_error(E_WARNING, "Class '%s' not found", ZSTR_VAL(class_name));
zend_string_release_ex(class_name, 0);
RETURN_NULL();
/* We currently don't early-bind classes that implement interfaces or use traits */
&& !(ce->ce_flags & (ZEND_ACC_IMPLEMENT_INTERFACES|ZEND_ACC_IMPLEMENT_TRAITS))) {
if (extends_ast) {
- zend_class_entry *parent_ce = zend_lookup_class_ex(ce->parent_name, NULL, 0);
+ zend_class_entry *parent_ce = zend_lookup_class_ex(
+ ce->parent_name, NULL, ZEND_FETCH_CLASS_NO_AUTOLOAD);
if (parent_ce
&& !(CG(compiler_options) & ZEND_COMPILE_PRELOAD) /* delay inheritance till preloading */
ZEND_API void execute_ex(zend_execute_data *execute_data);
ZEND_API void execute_internal(zend_execute_data *execute_data, zval *return_value);
ZEND_API zend_class_entry *zend_lookup_class(zend_string *name);
-ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, zend_string *lcname, int use_autoload);
+ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, zend_string *lcname, uint32_t flags);
ZEND_API zend_class_entry *zend_get_called_scope(zend_execute_data *ex);
ZEND_API zend_object *zend_get_this_object(zend_execute_data *ex);
ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name);
}
/* }}} */
-ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, zend_string *key, int use_autoload) /* {{{ */
+ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, zend_string *key, uint32_t flags) /* {{{ */
{
zend_class_entry *ce = NULL;
zval args[1], *zv;
/* The compiler is not-reentrant. Make sure we __autoload() only during run-time
* (doesn't impact functionality of __autoload()
*/
- if (!use_autoload || zend_is_compiling()) {
+ if ((flags & ZEND_FETCH_CLASS_NO_AUTOLOAD) || zend_is_compiling()) {
if (!key) {
zend_string_release_ex(lc_name, 0);
}
ZEND_API zend_class_entry *zend_lookup_class(zend_string *name) /* {{{ */
{
- return zend_lookup_class_ex(name, NULL, 1);
+ return zend_lookup_class_ex(name, NULL, 0);
}
/* }}} */
}
if (fetch_type & ZEND_FETCH_CLASS_NO_AUTOLOAD) {
- return zend_lookup_class_ex(class_name, NULL, 0);
- } else if ((ce = zend_lookup_class_ex(class_name, NULL, 1)) == NULL) {
+ return zend_lookup_class_ex(class_name, NULL, fetch_type);
+ } else if ((ce = zend_lookup_class_ex(class_name, NULL, fetch_type)) == NULL) {
if (!(fetch_type & ZEND_FETCH_CLASS_SILENT) && !EG(exception)) {
if (fetch_sub_type == ZEND_FETCH_CLASS_INTERFACE) {
zend_throw_or_error(fetch_type, NULL, "Interface '%s' not found", ZSTR_VAL(class_name));
zend_class_entry *ce;
if (fetch_type & ZEND_FETCH_CLASS_NO_AUTOLOAD) {
- return zend_lookup_class_ex(class_name, key, 0);
- } else if ((ce = zend_lookup_class_ex(class_name, key, 1)) == NULL) {
+ return zend_lookup_class_ex(class_name, key, fetch_type);
+ } else if ((ce = zend_lookup_class_ex(class_name, key, fetch_type)) == NULL) {
if (fetch_type & ZEND_FETCH_CLASS_SILENT) {
return NULL;
}
return ce;
}
} else {
- ce = zend_lookup_class_ex(name, NULL, /* autoload */ 0);
+ ce = zend_lookup_class_ex(name, NULL, ZEND_FETCH_CLASS_NO_AUTOLOAD);
if (ce && class_visible(ce)) {
return ce;
}