Merge branch 'PHP-7.4'

This commit is contained in:
Nikita Popov 2019-05-27 09:38:33 +02:00
commit 13f675b858
7 changed files with 15 additions and 14 deletions

View File

@ -2777,7 +2777,7 @@ static int zend_is_callable_check_class(zend_string *name, zend_class_entry *sco
*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);

View File

@ -980,7 +980,7 @@ static void is_a_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool only_subclass) /*
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 {
@ -1423,7 +1423,7 @@ ZEND_FUNCTION(class_alias)
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) {

View File

@ -205,7 +205,7 @@ ZEND_METHOD(Closure, bind)
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();

View File

@ -6280,7 +6280,8 @@ zend_op *zend_compile_class_decl(zend_ast *ast, zend_bool toplevel) /* {{{ */
/* 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 */

View File

@ -41,7 +41,7 @@ ZEND_API void zend_execute(zend_op_array *op_array, zval *return_value);
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);

View File

@ -832,7 +832,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) /
}
/* }}} */
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;
@ -871,7 +871,7 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, zend_string *
/* 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);
}
@ -946,7 +946,7 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, zend_string *
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);
}
/* }}} */
@ -1337,8 +1337,8 @@ check_fetch_type:
}
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));
@ -1359,8 +1359,8 @@ zend_class_entry *zend_fetch_class_by_name(zend_string *class_name, zend_string
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;
}

View File

@ -204,7 +204,7 @@ static zend_class_entry *lookup_class(const zend_function *fe, zend_string *name
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;
}