diff options
Diffstat (limited to 'Zend/zend_API.c')
-rw-r--r-- | Zend/zend_API.c | 344 |
1 files changed, 264 insertions, 80 deletions
diff --git a/Zend/zend_API.c b/Zend/zend_API.c index c513d5db5e..91247bbecc 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -154,7 +154,7 @@ ZEND_API void zend_wrong_param_count(void) /* {{{ */ const char *space; const char *class_name = get_active_class_name(&space); - zend_error(E_WARNING, "Wrong parameter count for %s%s%s()", class_name, space, get_active_function_name()); + zend_internal_type_error(ZEND_ARG_USES_STRICT_TYPES(), "Wrong parameter count for %s%s%s()", class_name, space, get_active_function_name()); } /* }}} */ @@ -164,6 +164,7 @@ ZEND_API char *zend_get_type_by_const(int type) /* {{{ */ switch(type) { case IS_FALSE: case IS_TRUE: + case _IS_BOOL: return "boolean"; case IS_LONG: return "integer"; @@ -194,51 +195,13 @@ ZEND_API char *zend_zval_type_name(const zval *arg) /* {{{ */ } /* }}} */ -ZEND_API int parse_arg_object_to_str(zval *arg, zend_string **str, int type) /* {{{ */ -{ - if (Z_OBJ_HANDLER_P(arg, cast_object)) { - zval obj; - if (Z_OBJ_HANDLER_P(arg, cast_object)(arg, &obj, type) == SUCCESS) { - zval_ptr_dtor(arg); - ZVAL_COPY_VALUE(arg, &obj); - *str = Z_STR_P(arg); - return SUCCESS; - } - } - /* Standard PHP objects */ - if (Z_OBJ_HT_P(arg) == &std_object_handlers || !Z_OBJ_HANDLER_P(arg, cast_object)) { - SEPARATE_ZVAL_NOREF(arg); - if (zend_std_cast_object_tostring(arg, arg, type) == SUCCESS) { - *str = Z_STR_P(arg); - return SUCCESS; - } - } - if (!Z_OBJ_HANDLER_P(arg, cast_object) && Z_OBJ_HANDLER_P(arg, get)) { - zval rv; - zval *z = Z_OBJ_HANDLER_P(arg, get)(arg, &rv); - Z_ADDREF_P(z); - if(Z_TYPE_P(z) != IS_OBJECT) { - zval_dtor(arg); - ZVAL_NULL(arg); - if (!zend_make_printable_zval(z, arg)) { - ZVAL_ZVAL(arg, z, 1, 1); - } - *str = Z_STR_P(arg); - return SUCCESS; - } - zval_ptr_dtor(z); - } - return FAILURE; -} -/* }}} */ - #ifdef FAST_ZPP -ZEND_API void zend_wrong_paramers_count_error(int num_args, int min_num_args, int max_num_args) /* {{{ */ +ZEND_API void ZEND_FASTCALL zend_wrong_paramers_count_error(int num_args, int min_num_args, int max_num_args) /* {{{ */ { zend_function *active_function = EG(current_execute_data)->func; const char *class_name = active_function->common.scope ? active_function->common.scope->name->val : ""; - zend_error(E_WARNING, "%s%s%s() expects %s %d parameter%s, %d given", + zend_internal_type_error(ZEND_ARG_USES_STRICT_TYPES(), "%s%s%s() expects %s %d parameter%s, %d given", class_name, \ class_name[0] ? "::" : "", \ active_function->common.function_name->val, @@ -249,7 +212,7 @@ ZEND_API void zend_wrong_paramers_count_error(int num_args, int min_num_args, in } /* }}} */ -ZEND_API void zend_wrong_paramer_type_error(int num, zend_expected_type expected_type, zval *arg) /* {{{ */ +ZEND_API void ZEND_FASTCALL zend_wrong_paramer_type_error(int num, zend_expected_type expected_type, zval *arg) /* {{{ */ { const char *space; const char *class_name = get_active_class_name(&space); @@ -258,33 +221,38 @@ ZEND_API void zend_wrong_paramer_type_error(int num, zend_expected_type expected NULL }; - zend_error(E_WARNING, "%s%s%s() expects parameter %d to be %s, %s given", + zend_internal_type_error(ZEND_ARG_USES_STRICT_TYPES(), "%s%s%s() expects parameter %d to be %s, %s given", class_name, space, get_active_function_name(), num, expected_error[expected_type], zend_zval_type_name(arg)); } /* }}} */ -ZEND_API void zend_wrong_paramer_class_error(int num, char *name, zval *arg) /* {{{ */ +ZEND_API void ZEND_FASTCALL zend_wrong_paramer_class_error(int num, char *name, zval *arg) /* {{{ */ { const char *space; const char *class_name = get_active_class_name(&space); - zend_error(E_WARNING, "%s%s%s() expects parameter %d to be %s, %s given", + zend_internal_type_error(ZEND_ARG_USES_STRICT_TYPES(), "%s%s%s() expects parameter %d to be %s, %s given", class_name, space, get_active_function_name(), num, name, zend_zval_type_name(arg)); } /* }}} */ -ZEND_API void zend_wrong_callback_error(int severity, int num, char *error) /* {{{ */ +ZEND_API void ZEND_FASTCALL zend_wrong_callback_error(int severity, int num, char *error) /* {{{ */ { const char *space; const char *class_name = get_active_class_name(&space); - zend_error(severity, "%s%s%s() expects parameter %d to be a valid callback, %s", - class_name, space, get_active_function_name(), num, error); + if (severity == E_WARNING) { + zend_internal_type_error(ZEND_ARG_USES_STRICT_TYPES(), "%s%s%s() expects parameter %d to be a valid callback, %s", + class_name, space, get_active_function_name(), num, error); + } else { + zend_error(severity, "%s%s%s() expects parameter %d to be a valid callback, %s", + class_name, space, get_active_function_name(), num, error); + } efree(error); } /* }}} */ -ZEND_API int zend_parse_arg_class(zval *arg, zend_class_entry **pce, int num, int check_null) /* {{{ */ +ZEND_API int ZEND_FASTCALL zend_parse_arg_class(zval *arg, zend_class_entry **pce, int num, int check_null) /* {{{ */ { zend_class_entry *ce_base = *pce; @@ -299,7 +267,7 @@ ZEND_API int zend_parse_arg_class(zval *arg, zend_class_entry **pce, int num, in const char *space; const char *class_name = get_active_class_name(&space); - zend_error(E_WARNING, "%s%s%s() expects parameter %d to be a class name derived from %s, '%s' given", + zend_internal_type_error(ZEND_ARG_USES_STRICT_TYPES(), "%s%s%s() expects parameter %d to be a class name derived from %s, '%s' given", class_name, space, get_active_function_name(), num, ce_base->name->val, Z_STRVAL_P(arg)); *pce = NULL; @@ -310,7 +278,7 @@ ZEND_API int zend_parse_arg_class(zval *arg, zend_class_entry **pce, int num, in const char *space; const char *class_name = get_active_class_name(&space); - zend_error(E_WARNING, "%s%s%s() expects parameter %d to be a valid class name, '%s' given", + zend_internal_type_error(ZEND_ARG_USES_STRICT_TYPES(), "%s%s%s() expects parameter %d to be a valid class name, '%s' given", class_name, space, get_active_function_name(), num, Z_STRVAL_P(arg)); return 0; @@ -320,6 +288,218 @@ ZEND_API int zend_parse_arg_class(zval *arg, zend_class_entry **pce, int num, in /* }}} */ #endif +ZEND_API int ZEND_FASTCALL zend_parse_arg_bool_weak(zval *arg, zend_bool *dest) /* {{{ */ +{ + if (EXPECTED(Z_TYPE_P(arg) <= IS_STRING)) { + *dest = zend_is_true(arg); + } else { + return 0; + } + return 1; +} +/* }}} */ + +ZEND_API int ZEND_FASTCALL zend_parse_arg_bool_slow(zval *arg, zend_bool *dest) /* {{{ */ +{ + if (UNEXPECTED(ZEND_ARG_USES_STRICT_TYPES())) { + return 0; + } + return zend_parse_arg_bool_weak(arg, dest); +} +/* }}} */ + +ZEND_API int ZEND_FASTCALL zend_parse_arg_long_weak(zval *arg, zend_long *dest) /* {{{ */ +{ + if (EXPECTED(Z_TYPE_P(arg) == IS_DOUBLE)) { + if (UNEXPECTED(zend_isnan(Z_DVAL_P(arg)))) { + return 0; + } + if (UNEXPECTED(!ZEND_DOUBLE_FITS_LONG(Z_DVAL_P(arg)))) { + return 0; + } else { + *dest = zend_dval_to_lval(Z_DVAL_P(arg)); + } + } else if (EXPECTED(Z_TYPE_P(arg) == IS_STRING)) { + double d; + int type; + + if (UNEXPECTED((type = is_numeric_str_function(Z_STR_P(arg), dest, &d)) != IS_LONG)) { + if (EXPECTED(type != 0)) { + if (UNEXPECTED(zend_isnan(d))) { + return 0; + } + if (UNEXPECTED(!ZEND_DOUBLE_FITS_LONG(d))) { + return 0; + } else { + *dest = zend_dval_to_lval(d); + } + } else { + return 0; + } + } + } else if (EXPECTED(Z_TYPE_P(arg) < IS_TRUE)) { + *dest = 0; + } else if (EXPECTED(Z_TYPE_P(arg) == IS_TRUE)) { + *dest = 1; + } else { + return 0; + } + return 1; +} +/* }}} */ + +ZEND_API int ZEND_FASTCALL zend_parse_arg_long_slow(zval *arg, zend_long *dest) /* {{{ */ +{ + if (UNEXPECTED(ZEND_ARG_USES_STRICT_TYPES())) { + return 0; + } + return zend_parse_arg_long_weak(arg, dest); +} +/* }}} */ + +ZEND_API int ZEND_FASTCALL zend_parse_arg_long_cap_weak(zval *arg, zend_long *dest) /* {{{ */ +{ + if (EXPECTED(Z_TYPE_P(arg) == IS_DOUBLE)) { + if (UNEXPECTED(zend_isnan(Z_DVAL_P(arg)))) { + return 0; + } + if (UNEXPECTED(!ZEND_DOUBLE_FITS_LONG(Z_DVAL_P(arg)))) { + *dest = (Z_DVAL_P(arg) > 0) ? ZEND_LONG_MAX : ZEND_LONG_MIN; + } else { + *dest = zend_dval_to_lval(Z_DVAL_P(arg)); + } + } else if (EXPECTED(Z_TYPE_P(arg) == IS_STRING)) { + double d; + int type; + + if (UNEXPECTED((type = is_numeric_str_function(Z_STR_P(arg), dest, &d)) != IS_LONG)) { + if (EXPECTED(type != 0)) { + if (UNEXPECTED(zend_isnan(d))) { + return 0; + } + if (UNEXPECTED(!ZEND_DOUBLE_FITS_LONG(d))) { + *dest = (d > 0) ? ZEND_LONG_MAX : ZEND_LONG_MIN; + } else { + *dest = zend_dval_to_lval(d); + } + } else { + return 0; + } + } + } else if (EXPECTED(Z_TYPE_P(arg) < IS_TRUE)) { + *dest = 0; + } else if (EXPECTED(Z_TYPE_P(arg) == IS_TRUE)) { + *dest = 1; + } else { + return 0; + } + return 1; +} +/* }}} */ + +ZEND_API int ZEND_FASTCALL zend_parse_arg_long_cap_slow(zval *arg, zend_long *dest) /* {{{ */ +{ + if (UNEXPECTED(ZEND_ARG_USES_STRICT_TYPES())) { + return 0; + } + return zend_parse_arg_long_cap_weak(arg, dest); +} +/* }}} */ + +ZEND_API int ZEND_FASTCALL zend_parse_arg_double_weak(zval *arg, double *dest) /* {{{ */ +{ + if (EXPECTED(Z_TYPE_P(arg) == IS_LONG)) { + *dest = (double)Z_LVAL_P(arg); + } else if (EXPECTED(Z_TYPE_P(arg) == IS_STRING)) { + zend_long l; + int type; + + if (UNEXPECTED((type = is_numeric_str_function(Z_STR_P(arg), &l, dest)) != IS_DOUBLE)) { + if (EXPECTED(type != 0)) { + *dest = (double)(l); + } else { + return 0; + } + } + } else if (EXPECTED(Z_TYPE_P(arg) < IS_TRUE)) { + *dest = 0.0; + } else if (EXPECTED(Z_TYPE_P(arg) == IS_TRUE)) { + *dest = 1.0; + } else { + return 0; + } + return 1; +} +/* }}} */ + +ZEND_API int ZEND_FASTCALL zend_parse_arg_double_slow(zval *arg, double *dest) /* {{{ */ +{ + if (EXPECTED(Z_TYPE_P(arg) == IS_LONG)) { + /* SSTH Exception: IS_LONG may be accepted instead as IS_DOUBLE */ + *dest = (double)Z_LVAL_P(arg); + } else if (UNEXPECTED(ZEND_ARG_USES_STRICT_TYPES())) { + return 0; + } + return zend_parse_arg_double_weak(arg, dest); +} +/* }}} */ + +ZEND_API int ZEND_FASTCALL zend_parse_arg_str_weak(zval *arg, zend_string **dest) /* {{{ */ +{ + if (EXPECTED(Z_TYPE_P(arg) < IS_STRING)) { + convert_to_string(arg); + *dest = Z_STR_P(arg); + } else if (UNEXPECTED(Z_TYPE_P(arg) == IS_OBJECT)) { + if (Z_OBJ_HANDLER_P(arg, cast_object)) { + zval obj; + if (Z_OBJ_HANDLER_P(arg, cast_object)(arg, &obj, IS_STRING) == SUCCESS) { + zval_ptr_dtor(arg); + ZVAL_COPY_VALUE(arg, &obj); + *dest = Z_STR_P(arg); + return 1; + } + } + /* Standard PHP objects */ + if (Z_OBJ_HT_P(arg) == &std_object_handlers || !Z_OBJ_HANDLER_P(arg, cast_object)) { + SEPARATE_ZVAL_NOREF(arg); + if (zend_std_cast_object_tostring(arg, arg, IS_STRING) == SUCCESS) { + *dest = Z_STR_P(arg); + return 1; + } + } + if (!Z_OBJ_HANDLER_P(arg, cast_object) && Z_OBJ_HANDLER_P(arg, get)) { + zval rv; + zval *z = Z_OBJ_HANDLER_P(arg, get)(arg, &rv); + + Z_ADDREF_P(z); + if (Z_TYPE_P(z) != IS_OBJECT) { + zval_dtor(arg); + ZVAL_NULL(arg); + if (!zend_make_printable_zval(z, arg)) { + ZVAL_ZVAL(arg, z, 1, 1); + } + *dest = Z_STR_P(arg); + return 1; + } + zval_ptr_dtor(z); + } + return 0; + } else { + return 0; + } + return 1; +} +/* }}} */ + +ZEND_API int ZEND_FASTCALL zend_parse_arg_str_slow(zval *arg, zend_string **dest) /* {{{ */ +{ + if (UNEXPECTED(ZEND_ARG_USES_STRICT_TYPES())) { + return 0; + } + return zend_parse_arg_str_weak(arg, dest); +} +/* }}} */ + static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, const char **spec, char **error, int *severity) /* {{{ */ { const char *spec_walk = *spec; @@ -539,7 +719,7 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons break; } else { if (is_callable_error) { - *severity = E_WARNING; + *severity = E_EXCEPTION | E_ERROR; zend_spprintf(error, 0, "to be a valid callback, %s", is_callable_error); efree(is_callable_error); return ""; @@ -570,24 +750,24 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons } /* }}} */ -static int zend_parse_arg(int arg_num, zval *arg, va_list *va, const char **spec, int quiet) /* {{{ */ +static int zend_parse_arg(int arg_num, zval *arg, va_list *va, const char **spec, int flags) /* {{{ */ { const char *expected_type = NULL; char *error = NULL; - int severity = E_WARNING; + int severity; expected_type = zend_parse_arg_impl(arg_num, arg, va, spec, &error, &severity); if (expected_type) { - if (!quiet && (*expected_type || error)) { + if (!(flags & ZEND_PARSE_PARAMS_QUIET) && (*expected_type || error)) { const char *space; const char *class_name = get_active_class_name(&space); if (error) { - zend_error(severity, "%s%s%s() expects parameter %d %s", - class_name, space, get_active_function_name(), arg_num, error); + zend_internal_type_error(ZEND_ARG_USES_STRICT_TYPES(), "%s%s%s() expects parameter %d %s", + class_name, space, get_active_function_name(), arg_num, error); efree(error); } else { - zend_error(severity, "%s%s%s() expects parameter %d to be %s, %s given", + zend_internal_type_error(ZEND_ARG_USES_STRICT_TYPES(), "%s%s%s() expects parameter %d to be %s, %s given", class_name, space, get_active_function_name(), arg_num, expected_type, zend_zval_type_name(arg)); } @@ -605,10 +785,9 @@ ZEND_API int zend_parse_parameter(int flags, int arg_num, zval *arg, const char { va_list va; int ret; - int quiet = flags & ZEND_PARSE_PARAMS_QUIET; va_start(va, spec); - ret = zend_parse_arg(arg_num, arg, &va, &spec, quiet); + ret = zend_parse_arg(arg_num, arg, &va, &spec, flags); va_end(va); return ret; @@ -623,7 +802,6 @@ static int zend_parse_va_args(int num_args, const char *type_spec, va_list *va, int post_varargs = 0; zval *arg; int arg_count; - int quiet = flags & ZEND_PARSE_PARAMS_QUIET; zend_bool have_varargs = 0; zval **varargs = NULL; int *n_varargs = NULL; @@ -656,9 +834,10 @@ static int zend_parse_va_args(int num_args, const char *type_spec, va_list *va, case '*': case '+': if (have_varargs) { - if (!quiet) { + if (!(flags & ZEND_PARSE_PARAMS_QUIET)) { zend_function *active_function = EG(current_execute_data)->func; const char *class_name = active_function->common.scope ? active_function->common.scope->name->val : ""; + zend_error(E_WARNING, "%s%s%s(): only one varargs specifier (* or +) is permitted", class_name, class_name[0] ? "::" : "", @@ -676,7 +855,7 @@ static int zend_parse_va_args(int num_args, const char *type_spec, va_list *va, break; default: - if (!quiet) { + if (!(flags & ZEND_PARSE_PARAMS_QUIET)) { zend_function *active_function = EG(current_execute_data)->func; const char *class_name = active_function->common.scope ? active_function->common.scope->name->val : ""; zend_error(E_WARNING, "%s%s%s(): bad type specifier while parsing parameters", @@ -699,10 +878,10 @@ static int zend_parse_va_args(int num_args, const char *type_spec, va_list *va, } if (num_args < min_num_args || (num_args > max_num_args && max_num_args > 0)) { - if (!quiet) { + if (!(flags & ZEND_PARSE_PARAMS_QUIET)) { zend_function *active_function = EG(current_execute_data)->func; const char *class_name = active_function->common.scope ? active_function->common.scope->name->val : ""; - zend_error(E_WARNING, "%s%s%s() expects %s %d parameter%s, %d given", + zend_internal_type_error(ZEND_ARG_USES_STRICT_TYPES(), "%s%s%s() expects %s %d parameter%s, %d given", class_name, class_name[0] ? "::" : "", active_function->common.function_name->val, @@ -751,7 +930,7 @@ static int zend_parse_va_args(int num_args, const char *type_spec, va_list *va, arg = ZEND_CALL_ARG(EG(current_execute_data), i + 1); - if (zend_parse_arg(i+1, arg, va, &type_spec, quiet) == FAILURE) { + if (zend_parse_arg(i+1, arg, va, &type_spec, flags) == FAILURE) { /* clean up varargs array if it was used */ if (varargs && *varargs) { *varargs = NULL; @@ -765,13 +944,13 @@ static int zend_parse_va_args(int num_args, const char *type_spec, va_list *va, } /* }}} */ -#define RETURN_IF_ZERO_ARGS(num_args, type_spec, quiet) { \ +#define RETURN_IF_ZERO_ARGS(num_args, type_spec, flags) { \ int __num_args = (num_args); \ \ - if (0 == (type_spec)[0] && 0 != __num_args && !(quiet)) { \ + if (0 == (type_spec)[0] && 0 != __num_args && !(flags & ZEND_PARSE_PARAMS_QUIET)) { \ const char *__space; \ const char * __class_name = get_active_class_name(&__space); \ - zend_error(E_WARNING, "%s%s%s() expects exactly 0 parameters, %d given", \ + zend_internal_type_error(ZEND_ARG_USES_STRICT_TYPES(), "%s%s%s() expects exactly 0 parameters, %d given", \ __class_name, __space, \ get_active_function_name(), __num_args); \ return FAILURE; \ @@ -783,7 +962,7 @@ ZEND_API int zend_parse_parameters_ex(int flags, int num_args, const char *type_ va_list va; int retval; - RETURN_IF_ZERO_ARGS(num_args, type_spec, flags & ZEND_PARSE_PARAMS_QUIET); + RETURN_IF_ZERO_ARGS(num_args, type_spec, flags); va_start(va, type_spec); retval = zend_parse_va_args(num_args, type_spec, &va, flags); @@ -797,11 +976,12 @@ ZEND_API int zend_parse_parameters(int num_args, const char *type_spec, ...) /* { va_list va; int retval; + int flags = 0; - RETURN_IF_ZERO_ARGS(num_args, type_spec, 0); + RETURN_IF_ZERO_ARGS(num_args, type_spec, flags); va_start(va, type_spec); - retval = zend_parse_va_args(num_args, type_spec, &va, 0); + retval = zend_parse_va_args(num_args, type_spec, &va, flags); va_end(va); return retval; @@ -812,6 +992,7 @@ ZEND_API int zend_parse_method_parameters(int num_args, zval *this_ptr, const ch { va_list va; int retval; + int flags = 0; const char *p = type_spec; zval **object; zend_class_entry *ce; @@ -821,15 +1002,16 @@ ZEND_API int zend_parse_method_parameters(int num_args, zval *this_ptr, const ch * In that case EG(This) would still be the $this from the calling code and we'd take the * wrong branch here. */ zend_bool is_method = EG(current_execute_data)->func->common.scope != NULL; + if (!is_method || !this_ptr || Z_TYPE_P(this_ptr) != IS_OBJECT) { - RETURN_IF_ZERO_ARGS(num_args, p, 0); + RETURN_IF_ZERO_ARGS(num_args, p, flags); va_start(va, type_spec); - retval = zend_parse_va_args(num_args, type_spec, &va, 0); + retval = zend_parse_va_args(num_args, type_spec, &va, flags); va_end(va); } else { p++; - RETURN_IF_ZERO_ARGS(num_args, p, 0); + RETURN_IF_ZERO_ARGS(num_args, p, flags); va_start(va, type_spec); @@ -842,7 +1024,7 @@ ZEND_API int zend_parse_method_parameters(int num_args, zval *this_ptr, const ch Z_OBJCE_P(this_ptr)->name->val, get_active_function_name(), ce->name->val, get_active_function_name()); } - retval = zend_parse_va_args(num_args, p, &va, 0); + retval = zend_parse_va_args(num_args, p, &va, flags); va_end(va); } return retval; @@ -856,17 +1038,16 @@ ZEND_API int zend_parse_method_parameters_ex(int flags, int num_args, zval *this const char *p = type_spec; zval **object; zend_class_entry *ce; - int quiet = flags & ZEND_PARSE_PARAMS_QUIET; if (!this_ptr) { - RETURN_IF_ZERO_ARGS(num_args, p, quiet); + RETURN_IF_ZERO_ARGS(num_args, p, flags); va_start(va, type_spec); retval = zend_parse_va_args(num_args, type_spec, &va, flags); va_end(va); } else { p++; - RETURN_IF_ZERO_ARGS(num_args, p, quiet); + RETURN_IF_ZERO_ARGS(num_args, p, flags); va_start(va, type_spec); @@ -875,7 +1056,7 @@ ZEND_API int zend_parse_method_parameters_ex(int flags, int num_args, zval *this *object = this_ptr; if (ce && !instanceof_function(Z_OBJCE_P(this_ptr), ce)) { - if (!quiet) { + if (!(flags & ZEND_PARSE_PARAMS_QUIET)) { zend_error(E_CORE_ERROR, "%s::%s() must be derived from %s::%s", ce->name->val, get_active_function_name(), Z_OBJCE_P(this_ptr)->name->val, get_active_function_name()); } @@ -2535,6 +2716,9 @@ ZEND_API int zend_register_class_alias_ex(const char *name, size_t name_len, zen lcname = zend_string_alloc(name_len, 1); zend_str_tolower_copy(lcname->val, name, name_len); } + + zend_assert_valid_class_name(lcname); + ce = zend_hash_add_ptr(CG(class_table), lcname, ce); zend_string_release(lcname); if (ce) { |