diff options
61 files changed, 1358 insertions, 1358 deletions
diff --git a/Zend/zend.c b/Zend/zend.c index 7fd6f7fc7b..c4f620b9f2 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -69,7 +69,7 @@ static ZEND_INI_MH(OnUpdateErrorReporting) /* {{{ */ if (!new_value) { EG(error_reporting) = E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED; } else { - EG(error_reporting) = atoi(new_value->val); + EG(error_reporting) = atoi(ZSTR_VAL(new_value)); } return SUCCESS; } @@ -95,7 +95,7 @@ static ZEND_INI_MH(OnUpdateScriptEncoding) /* {{{ */ if (!zend_multibyte_get_functions()) { return SUCCESS; } - return zend_multibyte_set_script_encoding_by_string(new_value ? new_value->val : NULL, new_value ? new_value->len : 0); + return zend_multibyte_set_script_encoding_by_string(new_value ? ZSTR_VAL(new_value) : NULL, new_value ? ZSTR_LEN(new_value) : 0); } /* }}} */ @@ -112,7 +112,7 @@ static ZEND_INI_MH(OnUpdateAssertions) /* {{{ */ p = (zend_long *) (base+(size_t) mh_arg1); - val = zend_atol(new_value->val, (int)new_value->len); + val = zend_atol(ZSTR_VAL(new_value), (int)ZSTR_LEN(new_value)); if (stage != ZEND_INI_STAGE_STARTUP && stage != ZEND_INI_STAGE_SHUTDOWN && @@ -199,7 +199,7 @@ static void print_hash(zend_write_func_t write_func, HashTable *ht, int indent, } } } else { - ZEND_WRITE_EX(string_key->val, string_key->len); + ZEND_WRITE_EX(ZSTR_VAL(string_key), ZSTR_LEN(string_key)); } } else { char key[25]; @@ -231,7 +231,7 @@ static void print_flat_hash(HashTable *ht) /* {{{ */ } ZEND_PUTS("["); if (string_key) { - ZEND_WRITE(string_key->val, string_key->len); + ZEND_WRITE(ZSTR_VAL(string_key), ZSTR_LEN(string_key)); } else { zend_printf(ZEND_ULONG_FMT, num_key); } @@ -261,10 +261,10 @@ ZEND_API size_t zend_print_zval(zval *expr, int indent) /* {{{ */ ZEND_API size_t zend_print_zval_ex(zend_write_func_t write_func, zval *expr, int indent) /* {{{ */ { zend_string *str = zval_get_string(expr); - size_t len = str->len; + size_t len = ZSTR_LEN(str); if (len != 0) { - write_func(str->val, len); + write_func(ZSTR_VAL(str), len); } zend_string_release(str); @@ -293,7 +293,7 @@ ZEND_API void zend_print_flat_zval_r(zval *expr) /* {{{ */ { HashTable *properties = NULL; zend_string *class_name = Z_OBJ_HANDLER_P(expr, get_class_name)(Z_OBJ_P(expr)); - zend_printf("%s Object (", class_name->val); + zend_printf("%s Object (", ZSTR_VAL(class_name)); zend_string_release(class_name); if (Z_OBJ_APPLY_COUNT_P(expr) > 0) { @@ -348,7 +348,7 @@ ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int int is_temp; zend_string *class_name = Z_OBJ_HANDLER_P(expr, get_class_name)(Z_OBJ_P(expr)); - ZEND_PUTS_EX(class_name->val); + ZEND_PUTS_EX(ZSTR_VAL(class_name)); zend_string_release(class_name); ZEND_PUTS_EX(" Object\n"); @@ -1121,7 +1121,7 @@ static void zend_error_va_list(int type, const char *format, va_list args) case E_USER_DEPRECATED: case E_RECOVERABLE_ERROR: if (zend_is_compiling()) { - error_filename = zend_get_compiled_filename()->val; + error_filename = ZSTR_VAL(zend_get_compiled_filename()); error_lineno = zend_get_compiled_lineno(); } else if (zend_is_executing()) { error_filename = zend_get_executed_filename(); @@ -1435,7 +1435,7 @@ ZEND_API char *zend_make_compiled_string_description(const char *name) /* {{{ */ char *compiled_string_description; if (zend_is_compiling()) { - cur_filename = zend_get_compiled_filename()->val; + cur_filename = ZSTR_VAL(zend_get_compiled_filename()); cur_lineno = zend_get_compiled_lineno(); } else if (zend_is_executing()) { cur_filename = zend_get_executed_filename(); diff --git a/Zend/zend_API.c b/Zend/zend_API.c index f6e1d1f0da..083160fdf2 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -199,12 +199,12 @@ ZEND_API char *zend_zval_type_name(const zval *arg) /* {{{ */ 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 : ""; + const char *class_name = active_function->common.scope ? ZSTR_VAL(active_function->common.scope->name) : ""; 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, + ZSTR_VAL(active_function->common.function_name), min_num_args == max_num_args ? "exactly" : num_args < min_num_args ? "at least" : "at most", num_args < min_num_args ? min_num_args : max_num_args, (num_args < min_num_args ? min_num_args : max_num_args) == 1 ? "" : "s", @@ -269,7 +269,7 @@ ZEND_API int ZEND_FASTCALL zend_parse_arg_class(zval *arg, zend_class_entry **pc 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)); + ZSTR_VAL(ce_base->name), Z_STRVAL_P(arg)); *pce = NULL; return 0; } @@ -646,7 +646,7 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons if (!zend_parse_arg_object(arg, p, ce, check_null)) { if (ce) { - return ce->name->val; + return ZSTR_VAL(ce->name); } else { return "object"; } @@ -672,7 +672,7 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons if (ce_base) { if ((!*pce || !instanceof_function(*pce, ce_base))) { zend_spprintf(error, 0, "to be a class name derived from %s, '%s' given", - ce_base->name->val, Z_STRVAL_P(arg)); + ZSTR_VAL(ce_base->name), Z_STRVAL_P(arg)); *pce = NULL; return ""; } @@ -790,10 +790,10 @@ ZEND_API int zend_parse_parameter(int flags, int arg_num, zval *arg, const char static void zend_parse_parameters_debug_error(const char *msg) { zend_function *active_function = EG(current_execute_data)->func; const char *class_name = active_function->common.scope - ? active_function->common.scope->name->val : ""; + ? ZSTR_VAL(active_function->common.scope->name) : ""; zend_error_noreturn(E_CORE_ERROR, "%s%s%s(): %s", class_name, class_name[0] ? "::" : "", - active_function->common.function_name->val, msg); + ZSTR_VAL(active_function->common.function_name), msg); } static int zend_parse_va_args(int num_args, const char *type_spec, va_list *va, int flags) /* {{{ */ @@ -869,13 +869,13 @@ 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 (!(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 : ""; + const char *class_name = active_function->common.scope ? ZSTR_VAL(active_function->common.scope->name) : ""; zend_bool throw_exception = ZEND_ARG_USES_STRICT_TYPES() || (flags & ZEND_PARSE_PARAMS_THROW); zend_internal_type_error(throw_exception, "%s%s%s() expects %s %d parameter%s, %d given", class_name, class_name[0] ? "::" : "", - active_function->common.function_name->val, + ZSTR_VAL(active_function->common.function_name), min_num_args == max_num_args ? "exactly" : num_args < min_num_args ? "at least" : "at most", num_args < min_num_args ? min_num_args : max_num_args, (num_args < min_num_args ? min_num_args : max_num_args) == 1 ? "" : "s", @@ -1028,7 +1028,7 @@ ZEND_API int zend_parse_method_parameters(int num_args, zval *this_ptr, const ch if (ce && !instanceof_function(Z_OBJCE_P(this_ptr), ce)) { zend_error_noreturn(E_CORE_ERROR, "%s::%s() must be derived from %s::%s", - Z_OBJCE_P(this_ptr)->name->val, get_active_function_name(), ce->name->val, get_active_function_name()); + ZSTR_VAL(Z_OBJCE_P(this_ptr)->name), get_active_function_name(), ZSTR_VAL(ce->name), get_active_function_name()); } retval = zend_parse_va_args(num_args, p, &va, flags); @@ -1065,7 +1065,7 @@ ZEND_API int zend_parse_method_parameters_ex(int flags, int num_args, zval *this if (ce && !instanceof_function(Z_OBJCE_P(this_ptr), ce)) { if (!(flags & ZEND_PARSE_PARAMS_QUIET)) { zend_error_noreturn(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()); + ZSTR_VAL(ce->name), get_active_function_name(), ZSTR_VAL(Z_OBJCE_P(this_ptr)->name), get_active_function_name()); } va_end(va); return FAILURE; @@ -1273,11 +1273,11 @@ ZEND_API int _object_and_properties_init(zval *arg, zend_class_entry *class_type { if (UNEXPECTED(class_type->ce_flags & (ZEND_ACC_INTERFACE|ZEND_ACC_TRAIT|ZEND_ACC_IMPLICIT_ABSTRACT_CLASS|ZEND_ACC_EXPLICIT_ABSTRACT_CLASS))) { if (class_type->ce_flags & ZEND_ACC_INTERFACE) { - zend_error(E_EXCEPTION | E_ERROR, "Cannot instantiate interface %s", class_type->name->val); + zend_error(E_EXCEPTION | E_ERROR, "Cannot instantiate interface %s", ZSTR_VAL(class_type->name)); } else if (class_type->ce_flags & ZEND_ACC_TRAIT) { - zend_error(E_EXCEPTION | E_ERROR, "Cannot instantiate trait %s", class_type->name->val); + zend_error(E_EXCEPTION | E_ERROR, "Cannot instantiate trait %s", ZSTR_VAL(class_type->name)); } else { - zend_error(E_EXCEPTION | E_ERROR, "Cannot instantiate abstract class %s", class_type->name->val); + zend_error(E_EXCEPTION | E_ERROR, "Cannot instantiate abstract class %s", ZSTR_VAL(class_type->name)); } ZVAL_NULL(arg); Z_OBJ_P(arg) = NULL; @@ -1821,7 +1821,7 @@ ZEND_API int zend_startup_module_ex(zend_module_entry *module) /* {{{ */ name_len = strlen(dep->name); lcname = zend_string_alloc(name_len, 0); - zend_str_tolower_copy(lcname->val, dep->name, name_len); + zend_str_tolower_copy(ZSTR_VAL(lcname), dep->name, name_len); if ((req_mod = zend_hash_find_ptr(&module_registry, lcname)) == NULL || !req_mod->module_started) { zend_string_free(lcname); @@ -2009,7 +2009,7 @@ ZEND_API zend_module_entry* zend_register_module_ex(zend_module_entry *module) / if (dep->type == MODULE_DEP_CONFLICTS) { name_len = strlen(dep->name); lcname = zend_string_alloc(name_len, 0); - zend_str_tolower_copy(lcname->val, dep->name, name_len); + zend_str_tolower_copy(ZSTR_VAL(lcname), dep->name, name_len); if (zend_hash_exists(&module_registry, lcname)) { zend_string_free(lcname); @@ -2025,7 +2025,7 @@ ZEND_API zend_module_entry* zend_register_module_ex(zend_module_entry *module) / name_len = strlen(module->name); lcname = zend_string_alloc(name_len, 1); - zend_str_tolower_copy(lcname->val, module->name, name_len); + zend_str_tolower_copy(ZSTR_VAL(lcname), module->name, name_len); if ((module_ptr = zend_hash_add_mem(&module_registry, lcname, module, sizeof(zend_module_entry))) == NULL) { zend_error(E_CORE_WARNING, "Module '%s' already loaded", module->name); @@ -2062,59 +2062,59 @@ ZEND_API void zend_check_magic_method_implementation(const zend_class_entry *ce, /* we don't care if the function name is longer, in fact lowercasing only * the beginning of the name speeds up the check process */ - name_len = fptr->common.function_name->len; - zend_str_tolower_copy(lcname, fptr->common.function_name->val, MIN(name_len, sizeof(lcname)-1)); + name_len = ZSTR_LEN(fptr->common.function_name); + zend_str_tolower_copy(lcname, ZSTR_VAL(fptr->common.function_name), MIN(name_len, sizeof(lcname)-1)); lcname[sizeof(lcname)-1] = '\0'; /* zend_str_tolower_copy won't necessarily set the zero byte */ if (name_len == sizeof(ZEND_DESTRUCTOR_FUNC_NAME) - 1 && !memcmp(lcname, ZEND_DESTRUCTOR_FUNC_NAME, sizeof(ZEND_DESTRUCTOR_FUNC_NAME) - 1) && fptr->common.num_args != 0) { - zend_error(error_type, "Destructor %s::%s() cannot take arguments", ce->name->val, ZEND_DESTRUCTOR_FUNC_NAME); + zend_error(error_type, "Destructor %s::%s() cannot take arguments", ZSTR_VAL(ce->name), ZEND_DESTRUCTOR_FUNC_NAME); } else if (name_len == sizeof(ZEND_CLONE_FUNC_NAME) - 1 && !memcmp(lcname, ZEND_CLONE_FUNC_NAME, sizeof(ZEND_CLONE_FUNC_NAME) - 1) && fptr->common.num_args != 0) { - zend_error(error_type, "Method %s::%s() cannot accept any arguments", ce->name->val, ZEND_CLONE_FUNC_NAME); + zend_error(error_type, "Method %s::%s() cannot accept any arguments", ZSTR_VAL(ce->name), ZEND_CLONE_FUNC_NAME); } else if (name_len == sizeof(ZEND_GET_FUNC_NAME) - 1 && !memcmp(lcname, ZEND_GET_FUNC_NAME, sizeof(ZEND_GET_FUNC_NAME) - 1)) { if (fptr->common.num_args != 1) { - zend_error(error_type, "Method %s::%s() must take exactly 1 argument", ce->name->val, ZEND_GET_FUNC_NAME); + zend_error(error_type, "Method %s::%s() must take exactly 1 argument", ZSTR_VAL(ce->name), ZEND_GET_FUNC_NAME); } else if (ARG_SHOULD_BE_SENT_BY_REF(fptr, 1)) { - zend_error(error_type, "Method %s::%s() cannot take arguments by reference", ce->name->val, ZEND_GET_FUNC_NAME); + zend_error(error_type, "Method %s::%s() cannot take arguments by reference", ZSTR_VAL(ce->name), ZEND_GET_FUNC_NAME); } } else if (name_len == sizeof(ZEND_SET_FUNC_NAME) - 1 && !memcmp(lcname, ZEND_SET_FUNC_NAME, sizeof(ZEND_SET_FUNC_NAME) - 1)) { if (fptr->common.num_args != 2) { - zend_error(error_type, "Method %s::%s() must take exactly 2 arguments", ce->name->val, ZEND_SET_FUNC_NAME); + zend_error(error_type, "Method %s::%s() must take exactly 2 arguments", ZSTR_VAL(ce->name), ZEND_SET_FUNC_NAME); } else if (ARG_SHOULD_BE_SENT_BY_REF(fptr, 1) || ARG_SHOULD_BE_SENT_BY_REF(fptr, 2)) { - zend_error(error_type, "Method %s::%s() cannot take arguments by reference", ce->name->val, ZEND_SET_FUNC_NAME); + zend_error(error_type, "Method %s::%s() cannot take arguments by reference", ZSTR_VAL(ce->name), ZEND_SET_FUNC_NAME); } } else if (name_len == sizeof(ZEND_UNSET_FUNC_NAME) - 1 && !memcmp(lcname, ZEND_UNSET_FUNC_NAME, sizeof(ZEND_UNSET_FUNC_NAME) - 1)) { if (fptr->common.num_args != 1) { - zend_error(error_type, "Method %s::%s() must take exactly 1 argument", ce->name->val, ZEND_UNSET_FUNC_NAME); + zend_error(error_type, "Method %s::%s() must take exactly 1 argument", ZSTR_VAL(ce->name), ZEND_UNSET_FUNC_NAME); } else if (ARG_SHOULD_BE_SENT_BY_REF(fptr, 1)) { - zend_error(error_type, "Method %s::%s() cannot take arguments by reference", ce->name->val, ZEND_UNSET_FUNC_NAME); + zend_error(error_type, "Method %s::%s() cannot take arguments by reference", ZSTR_VAL(ce->name), ZEND_UNSET_FUNC_NAME); } } else if (name_len == sizeof(ZEND_ISSET_FUNC_NAME) - 1 && !memcmp(lcname, ZEND_ISSET_FUNC_NAME, sizeof(ZEND_ISSET_FUNC_NAME) - 1)) { if (fptr->common.num_args != 1) { - zend_error(error_type, "Method %s::%s() must take exactly 1 argument", ce->name->val, ZEND_ISSET_FUNC_NAME); + zend_error(error_type, "Method %s::%s() must take exactly 1 argument", ZSTR_VAL(ce->name), ZEND_ISSET_FUNC_NAME); } else if (ARG_SHOULD_BE_SENT_BY_REF(fptr, 1)) { - zend_error(error_type, "Method %s::%s() cannot take arguments by reference", ce->name->val, ZEND_ISSET_FUNC_NAME); + zend_error(error_type, "Method %s::%s() cannot take arguments by reference", ZSTR_VAL(ce->name), ZEND_ISSET_FUNC_NAME); } } else if (name_len == sizeof(ZEND_CALL_FUNC_NAME) - 1 && !memcmp(lcname, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME) - 1)) { if (fptr->common.num_args != 2) { - zend_error(error_type, "Method %s::%s() must take exactly 2 arguments", ce->name->val, ZEND_CALL_FUNC_NAME); + zend_error(error_type, "Method %s::%s() must take exactly 2 arguments", ZSTR_VAL(ce->name), ZEND_CALL_FUNC_NAME); } else if (ARG_SHOULD_BE_SENT_BY_REF(fptr, 1) || ARG_SHOULD_BE_SENT_BY_REF(fptr, 2)) { - zend_error(error_type, "Method %s::%s() cannot take arguments by reference", ce->name->val, ZEND_CALL_FUNC_NAME); + zend_error(error_type, "Method %s::%s() cannot take arguments by reference", ZSTR_VAL(ce->name), ZEND_CALL_FUNC_NAME); } } else if (name_len == sizeof(ZEND_CALLSTATIC_FUNC_NAME) - 1 && !memcmp(lcname, ZEND_CALLSTATIC_FUNC_NAME, sizeof(ZEND_CALLSTATIC_FUNC_NAME)-1) ) { if (fptr->common.num_args != 2) { - zend_error(error_type, "Method %s::__callStatic() must take exactly 2 arguments", ce->name->val); + zend_error(error_type, "Method %s::__callStatic() must take exactly 2 arguments", ZSTR_VAL(ce->name)); } else if (ARG_SHOULD_BE_SENT_BY_REF(fptr, 1) || ARG_SHOULD_BE_SENT_BY_REF(fptr, 2)) { - zend_error(error_type, "Method %s::__callStatic() cannot take arguments by reference", ce->name->val); + zend_error(error_type, "Method %s::__callStatic() cannot take arguments by reference", ZSTR_VAL(ce->name)); } } else if (name_len == sizeof(ZEND_TOSTRING_FUNC_NAME) - 1 && !memcmp(lcname, ZEND_TOSTRING_FUNC_NAME, sizeof(ZEND_TOSTRING_FUNC_NAME)-1) && fptr->common.num_args != 0 ) { - zend_error(error_type, "Method %s::%s() cannot take arguments", ce->name->val, ZEND_TOSTRING_FUNC_NAME); + zend_error(error_type, "Method %s::%s() cannot take arguments", ZSTR_VAL(ce->name), ZEND_TOSTRING_FUNC_NAME); } else if (name_len == sizeof(ZEND_DEBUGINFO_FUNC_NAME) - 1 && !memcmp(lcname, ZEND_DEBUGINFO_FUNC_NAME, sizeof(ZEND_DEBUGINFO_FUNC_NAME)-1) && fptr->common.num_args != 0) { - zend_error(error_type, "Method %s::%s() cannot take arguments", ce->name->val, ZEND_DEBUGINFO_FUNC_NAME); + zend_error(error_type, "Method %s::%s() cannot take arguments", ZSTR_VAL(ce->name), ZEND_DEBUGINFO_FUNC_NAME); } } /* }}} */ @@ -2147,13 +2147,13 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio internal_function->module = EG(current_module); if (scope) { - class_name_len = scope->name->len; - if ((lc_class_name = zend_memrchr(scope->name->val, '\\', class_name_len))) { + class_name_len = ZSTR_LEN(scope->name); + if ((lc_class_name = zend_memrchr(ZSTR_VAL(scope->name), '\\', class_name_len))) { ++lc_class_name; - class_name_len -= (lc_class_name - scope->name->val); + class_name_len -= (lc_class_name - ZSTR_VAL(scope->name)); lc_class_name = zend_str_tolower_dup(lc_class_name, class_name_len); } else { - lc_class_name = zend_str_tolower_dup(scope->name->val, class_name_len); + lc_class_name = zend_str_tolower_dup(ZSTR_VAL(scope->name), class_name_len); } } @@ -2166,7 +2166,7 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio if (ptr->flags) { if (!(ptr->flags & ZEND_ACC_PPP_MASK)) { if (ptr->flags != ZEND_ACC_DEPRECATED || scope) { - zend_error(error_type, "Invalid access level for %s%s%s() - access must be exactly one of public, protected or private", scope ? scope->name->val : "", scope ? "::" : "", ptr->fname); + zend_error(error_type, "Invalid access level for %s%s%s() - access must be exactly one of public, protected or private", scope ? ZSTR_VAL(scope->name) : "", scope ? "::" : "", ptr->fname); } internal_function->fn_flags = ZEND_ACC_PUBLIC | ptr->flags; } else { @@ -2222,25 +2222,25 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio } } if (ptr->flags & ZEND_ACC_STATIC && (!scope || !(scope->ce_flags & ZEND_ACC_INTERFACE))) { - zend_error(error_type, "Static function %s%s%s() cannot be abstract", scope ? scope->name->val : "", scope ? "::" : "", ptr->fname); + zend_error(error_type, "Static function %s%s%s() cannot be abstract", scope ? ZSTR_VAL(scope->name) : "", scope ? "::" : "", ptr->fname); } } else { if (scope && (scope->ce_flags & ZEND_ACC_INTERFACE)) { efree((char*)lc_class_name); - zend_error(error_type, "Interface %s cannot contain non abstract method %s()", scope->name->val, ptr->fname); + zend_error(error_type, "Interface %s cannot contain non abstract method %s()", ZSTR_VAL(scope->name), ptr->fname); return FAILURE; } if (!internal_function->handler) { if (scope) { efree((char*)lc_class_name); } - zend_error(error_type, "Method %s%s%s() cannot be a NULL function", scope ? scope->name->val : "", scope ? "::" : "", ptr->fname); + zend_error(error_type, "Method %s%s%s() cannot be a NULL function", scope ? ZSTR_VAL(scope->name) : "", scope ? "::" : "", ptr->fname); zend_unregister_functions(functions, count, target_function_table); return FAILURE; } } lowercase_name = zend_string_alloc(fname_len, 1); - zend_str_tolower_copy(lowercase_name->val, ptr->fname, fname_len); + zend_str_tolower_copy(ZSTR_VAL(lowercase_name), ptr->fname, fname_len); lowercase_name = zend_new_interned_string(lowercase_name); reg_function = malloc(sizeof(zend_internal_function)); memcpy(reg_function, &function, sizeof(zend_internal_function)); @@ -2268,14 +2268,14 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio * If it's an old-style constructor, store it only if we don't have * a constructor already. */ - if ((fname_len == class_name_len) && !ctor && !memcmp(lowercase_name->val, lc_class_name, class_name_len+1)) { + if ((fname_len == class_name_len) && !ctor && !memcmp(ZSTR_VAL(lowercase_name), lc_class_name, class_name_len+1)) { ctor = reg_function; } else if (zend_string_equals_literal(lowercase_name, ZEND_CONSTRUCTOR_FUNC_NAME)) { ctor = reg_function; } else if (zend_string_equals_literal(lowercase_name, ZEND_DESTRUCTOR_FUNC_NAME)) { dtor = reg_function; if (internal_function->num_args) { - zend_error(error_type, "Destructor %s::%s() cannot take arguments", scope->name->val, ptr->fname); + zend_error(error_type, "Destructor %s::%s() cannot take arguments", ZSTR_VAL(scope->name), ptr->fname); } } else if (zend_string_equals_literal(lowercase_name, ZEND_CLONE_FUNC_NAME)) { clone = reg_function; @@ -2317,9 +2317,9 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio while (ptr->fname) { fname_len = strlen(ptr->fname); lowercase_name = zend_string_alloc(fname_len, 0); - zend_str_tolower_copy(lowercase_name->val, ptr->fname, fname_len); + zend_str_tolower_copy(ZSTR_VAL(lowercase_name), ptr->fname, fname_len); if (zend_hash_exists(target_function_table, lowercase_name)) { - zend_error(error_type, "Function registration failed - duplicate name - %s%s%s", scope ? scope->name->val : "", scope ? "::" : "", ptr->fname); + zend_error(error_type, "Function registration failed - duplicate name - %s%s%s", scope ? ZSTR_VAL(scope->name) : "", scope ? "::" : "", ptr->fname); } zend_string_free(lowercase_name); ptr++; @@ -2342,82 +2342,82 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio if (ctor) { ctor->common.fn_flags |= ZEND_ACC_CTOR; if (ctor->common.fn_flags & ZEND_ACC_STATIC) { - zend_error(error_type, "Constructor %s::%s() cannot be static", scope->name->val, ctor->common.function_name->val); + zend_error(error_type, "Constructor %s::%s() cannot be static", ZSTR_VAL(scope->name), ZSTR_VAL(ctor->common.function_name)); } ctor->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC; } if (dtor) { dtor->common.fn_flags |= ZEND_ACC_DTOR; if (dtor->common.fn_flags & ZEND_ACC_STATIC) { - zend_error(error_type, "Destructor %s::%s() cannot be static", scope->name->val, dtor->common.function_name->val); + zend_error(error_type, "Destructor %s::%s() cannot be static", ZSTR_VAL(scope->name), ZSTR_VAL(dtor->common.function_name)); } dtor->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC; } if (clone) { clone->common.fn_flags |= ZEND_ACC_CLONE; if (clone->common.fn_flags & ZEND_ACC_STATIC) { - zend_error(error_type, "Constructor %s::%s() cannot be static", scope->name->val, clone->common.function_name->val); + zend_error(error_type, "Constructor %s::%s() cannot be static", ZSTR_VAL(scope->name), ZSTR_VAL(clone->common.function_name)); } clone->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC; } if (__call) { if (__call->common.fn_flags & ZEND_ACC_STATIC) { - zend_error(error_type, "Method %s::%s() cannot be static", scope->name->val, __call->common.function_name->val); + zend_error(error_type, "Method %s::%s() cannot be static", ZSTR_VAL(scope->name), ZSTR_VAL(__call->common.function_name)); } __call->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC; } if (__callstatic) { if (!(__callstatic->common.fn_flags & ZEND_ACC_STATIC)) { - zend_error(error_type, "Method %s::%s() must be static", scope->name->val, __callstatic->common.function_name->val); + zend_error(error_type, "Method %s::%s() must be static", ZSTR_VAL(scope->name), ZSTR_VAL(__callstatic->common.function_name)); } __callstatic->common.fn_flags |= ZEND_ACC_STATIC; } if (__tostring) { if (__tostring->common.fn_flags & ZEND_ACC_STATIC) { - zend_error(error_type, "Method %s::%s() cannot be static", scope->name->val, __tostring->common.function_name->val); + zend_error(error_type, "Method %s::%s() cannot be static", ZSTR_VAL(scope->name), ZSTR_VAL(__tostring->common.function_name)); } __tostring->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC; } if (__get) { if (__get->common.fn_flags & ZEND_ACC_STATIC) { - zend_error(error_type, "Method %s::%s() cannot be static", scope->name->val, __get->common.function_name->val); + zend_error(error_type, "Method %s::%s() cannot be static", ZSTR_VAL(scope->name), ZSTR_VAL(__get->common.function_name)); } __get->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC; } if (__set) { if (__set->common.fn_flags & ZEND_ACC_STATIC) { - zend_error(error_type, "Method %s::%s() cannot be static", scope->name->val, __set->common.function_name->val); + zend_error(error_type, "Method %s::%s() cannot be static", ZSTR_VAL(scope->name), ZSTR_VAL(__set->common.function_name)); } __set->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC; } if (__unset) { if (__unset->common.fn_flags & ZEND_ACC_STATIC) { - zend_error(error_type, "Method %s::%s() cannot be static", scope->name->val, __unset->common.function_name->val); + zend_error(error_type, "Method %s::%s() cannot be static", ZSTR_VAL(scope->name), ZSTR_VAL(__unset->common.function_name)); } __unset->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC; } if (__isset) { if (__isset->common.fn_flags & ZEND_ACC_STATIC) { - zend_error(error_type, "Method %s::%s() cannot be static", scope->name->val, __isset->common.function_name->val); + zend_error(error_type, "Method %s::%s() cannot be static", ZSTR_VAL(scope->name), ZSTR_VAL(__isset->common.function_name)); } __isset->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC; } if (__debugInfo) { if (__debugInfo->common.fn_flags & ZEND_ACC_STATIC) { - zend_error(error_type, "Method %s::%s() cannot be static", scope->name->val, __debugInfo->common.function_name->val); + zend_error(error_type, "Method %s::%s() cannot be static", ZSTR_VAL(scope->name), ZSTR_VAL(__debugInfo->common.function_name)); } } if (ctor && ctor->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE && ctor->common.fn_flags & ZEND_ACC_CTOR) { - zend_error_noreturn(E_CORE_ERROR, "Constructor %s::%s() cannot declare a return type", scope->name->val, ctor->common.function_name->val); + zend_error_noreturn(E_CORE_ERROR, "Constructor %s::%s() cannot declare a return type", ZSTR_VAL(scope->name), ZSTR_VAL(ctor->common.function_name)); } if (dtor && dtor->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE && dtor->common.fn_flags & ZEND_ACC_DTOR) { - zend_error_noreturn(E_CORE_ERROR, "Destructor %s::%s() cannot declare a return type", scope->name->val, dtor->common.function_name->val); + zend_error_noreturn(E_CORE_ERROR, "Destructor %s::%s() cannot declare a return type", ZSTR_VAL(scope->name), ZSTR_VAL(dtor->common.function_name)); } if (clone && clone->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE && dtor->common.fn_flags & ZEND_ACC_DTOR) { - zend_error_noreturn(E_CORE_ERROR, "%s::%s() cannot declare a return type", scope->name->val, clone->common.function_name->val); + zend_error_noreturn(E_CORE_ERROR, "%s::%s() cannot declare a return type", ZSTR_VAL(scope->name), ZSTR_VAL(clone->common.function_name)); } efree((char*)lc_class_name); } @@ -2445,7 +2445,7 @@ ZEND_API void zend_unregister_functions(const zend_function_entry *functions, in } fname_len = strlen(ptr->fname); lowercase_name = zend_string_alloc(fname_len, 0); - zend_str_tolower_copy(lowercase_name->val, ptr->fname, fname_len); + zend_str_tolower_copy(ZSTR_VAL(lowercase_name), ptr->fname, fname_len); zend_hash_del(target_function_table, lowercase_name); zend_string_free(lowercase_name); ptr++; @@ -2648,7 +2648,7 @@ ZEND_API int zend_next_free_module(void) /* {{{ */ static zend_class_entry *do_register_internal_class(zend_class_entry *orig_class_entry, uint32_t ce_flags) /* {{{ */ { zend_class_entry *class_entry = malloc(sizeof(zend_class_entry)); - zend_string *lowercase_name = zend_string_alloc(orig_class_entry->name->len, 1); + zend_string *lowercase_name = zend_string_alloc(ZSTR_LEN(orig_class_entry->name), 1); *class_entry = *orig_class_entry; class_entry->type = ZEND_INTERNAL_CLASS; @@ -2660,7 +2660,7 @@ static zend_class_entry *do_register_internal_class(zend_class_entry *orig_class zend_register_functions(class_entry, class_entry->info.internal.builtin_functions, &class_entry->function_table, MODULE_PERSISTENT); } - zend_str_tolower_copy(lowercase_name->val, orig_class_entry->name->val, class_entry->name->len); + zend_str_tolower_copy(ZSTR_VAL(lowercase_name), ZSTR_VAL(orig_class_entry->name), ZSTR_LEN(class_entry->name)); lowercase_name = zend_new_interned_string(lowercase_name); zend_hash_update_ptr(CG(class_table), lowercase_name, class_entry); zend_string_release(lowercase_name); @@ -2721,10 +2721,10 @@ ZEND_API int zend_register_class_alias_ex(const char *name, size_t name_len, zen if (name[0] == '\\') { lcname = zend_string_alloc(name_len-1, 1); - zend_str_tolower_copy(lcname->val, name+1, name_len-1); + zend_str_tolower_copy(ZSTR_VAL(lcname), name+1, name_len-1); } else { lcname = zend_string_alloc(name_len, 1); - zend_str_tolower_copy(lcname->val, name, name_len); + zend_str_tolower_copy(ZSTR_VAL(lcname), name, name_len); } zend_assert_valid_class_name(lcname); @@ -2795,7 +2795,7 @@ static zend_object *display_disabled_class(zend_class_entry *class_type) /* {{{ zend_object *intern; intern = zend_objects_new(class_type); - zend_error(E_WARNING, "%s() has been disabled for security reasons", class_type->name->val); + zend_error(E_WARNING, "%s() has been disabled for security reasons", ZSTR_VAL(class_type->name)); return intern; } #ifdef ZEND_WIN32 @@ -2813,7 +2813,7 @@ ZEND_API int zend_disable_class(char *class_name, size_t class_name_length) /* { zend_string *key; key = zend_string_alloc(class_name_length, 0); - zend_str_tolower_copy(key->val, class_name, class_name_length); + zend_str_tolower_copy(ZSTR_VAL(key), class_name, class_name_length); disabled_class = zend_hash_find_ptr(CG(class_table), key); if (!disabled_class) { return FAILURE; @@ -2829,12 +2829,12 @@ static int zend_is_callable_check_class(zend_string *name, zend_fcall_info_cache { int ret = 0; zend_class_entry *ce; - size_t name_len = name->len; + size_t name_len = ZSTR_LEN(name); zend_string *lcname; ALLOCA_FLAG(use_heap); ZSTR_ALLOCA_ALLOC(lcname, name_len, use_heap); - zend_str_tolower_copy(lcname->val, name->val, name_len); + zend_str_tolower_copy(ZSTR_VAL(lcname), ZSTR_VAL(name), name_len); *strict_class = 0; if (zend_string_equals_literal(lcname, "self")) { @@ -2902,7 +2902,7 @@ static int zend_is_callable_check_class(zend_string *name, zend_fcall_info_cache *strict_class = 1; ret = 1; } else { - if (error) zend_spprintf(error, 0, "class '%.*s' not found", name_len, name->val); + if (error) zend_spprintf(error, 0, "class '%.*s' not found", name_len, ZSTR_VAL(name)); } ZSTR_ALLOCA_FREE(lcname, use_heap); return ret; @@ -2951,7 +2951,7 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca } else { zend_string_forget_hash_val(lmname); } - zend_str_tolower(lmname->val, lmname->len); + zend_str_tolower(ZSTR_VAL(lmname), ZSTR_LEN(lmname)); if ((fcc->function_handler = zend_hash_find_ptr(EG(function_table), lmname)) != NULL) { ZSTR_ALLOCA_FREE(lmname, use_heap); return 1; @@ -2994,7 +2994,7 @@ static int zend_is_callable_check_func(int check_flags, zval *callable, zend_fca ftable = &fcc->calling_scope->function_table; if (ce_org && !instanceof_function(ce_org, fcc->calling_scope)) { - if (error) zend_spprintf(error, 0, "class '%s' is not a subclass of '%s'", ce_org->name->val, fcc->calling_scope->name->val); + if (error) zend_spprintf(error, 0, "class '%s' is not a subclass of '%s'", ZSTR_VAL(ce_org->name), ZSTR_VAL(fcc->calling_scope->name)); return 0; } mname = zend_string_init(Z_STRVAL_P(callable) + clen + 2, mlen, 0); @@ -3101,10 +3101,10 @@ get_function_via_handler: if (fcc->calling_scope && !call_via_handler) { if (!fcc->object && (fcc->function_handler->common.fn_flags & ZEND_ACC_ABSTRACT)) { if (error) { - zend_spprintf(error, 0, "cannot call abstract method %s::%s()", fcc->calling_scope->name->val, fcc->function_handler->common.function_name->val); + zend_spprintf(error, 0, "cannot call abstract method %s::%s()", ZSTR_VAL(fcc->calling_scope->name), ZSTR_VAL(fcc->function_handler->common.function_name)); retval = 0; } else { - zend_error(E_EXCEPTION | E_ERROR, "Cannot call abstract method %s::%s()", fcc->calling_scope->name->val, fcc->function_handler->common.function_name->val); + zend_error(E_EXCEPTION | E_ERROR, "Cannot call abstract method %s::%s()", ZSTR_VAL(fcc->calling_scope->name), ZSTR_VAL(fcc->function_handler->common.function_name)); return 0; } } else if (!fcc->object && !(fcc->function_handler->common.fn_flags & ZEND_ACC_STATIC)) { @@ -3122,12 +3122,12 @@ get_function_via_handler: retval = 0; } if (error) { - zend_spprintf(error, 0, "non-static method %s::%s() %s be called statically", fcc->calling_scope->name->val, fcc->function_handler->common.function_name->val, verb); + zend_spprintf(error, 0, "non-static method %s::%s() %s be called statically", ZSTR_VAL(fcc->calling_scope->name), ZSTR_VAL(fcc->function_handler->common.function_name), verb); if (severity != E_DEPRECATED) { retval = 0; } } else if (retval) { - zend_error(severity, "Non-static method %s::%s() %s be called statically", fcc->calling_scope->name->val, fcc->function_handler->common.function_name->val, verb); + zend_error(severity, "Non-static method %s::%s() %s be called statically", ZSTR_VAL(fcc->calling_scope->name), ZSTR_VAL(fcc->function_handler->common.function_name), verb); } } if (retval && (check_flags & IS_CALLABLE_CHECK_NO_ACCESS) == 0) { @@ -3137,7 +3137,7 @@ get_function_via_handler: if (*error) { efree(*error); } - zend_spprintf(error, 0, "cannot access private method %s::%s()", fcc->calling_scope->name->val, fcc->function_handler->common.function_name->val); + zend_spprintf(error, 0, "cannot access private method %s::%s()", ZSTR_VAL(fcc->calling_scope->name), ZSTR_VAL(fcc->function_handler->common.function_name)); } retval = 0; } @@ -3147,7 +3147,7 @@ get_function_via_handler: if (*error) { efree(*error); } - zend_spprintf(error, 0, "cannot access protected method %s::%s()", fcc->calling_scope->name->val, fcc->function_handler->common.function_name->val); + zend_spprintf(error, 0, "cannot access protected method %s::%s()", ZSTR_VAL(fcc->calling_scope->name), ZSTR_VAL(fcc->function_handler->common.function_name)); } retval = 0; } @@ -3156,9 +3156,9 @@ get_function_via_handler: } } else if (error && !(check_flags & IS_CALLABLE_CHECK_SILENT)) { if (fcc->calling_scope) { - if (error) zend_spprintf(error, 0, "class '%s' does not have a method '%s'", fcc->calling_scope->name->val, mname->val); + if (error) zend_spprintf(error, 0, "class '%s' does not have a method '%s'", ZSTR_VAL(fcc->calling_scope->name), ZSTR_VAL(mname)); } else { - if (error) zend_spprintf(error, 0, "function '%s' does not exist", mname->val); + if (error) zend_spprintf(error, 0, "function '%s' does not exist", ZSTR_VAL(mname)); } } zend_string_release(lmname); @@ -3210,10 +3210,10 @@ again: if (callable_name) { char *ptr; - *callable_name = zend_string_alloc(fcc->calling_scope->name->len + Z_STRLEN_P(callable) + sizeof("::") - 1, 0); - ptr = (*callable_name)->val; - memcpy(ptr, fcc->calling_scope->name->val, fcc->calling_scope->name->len); - ptr += fcc->calling_scope->name->len; + *callable_name = zend_string_alloc(ZSTR_LEN(fcc->calling_scope->name) + Z_STRLEN_P(callable) + sizeof("::") - 1, 0); + ptr = ZSTR_VAL(*callable_name); + memcpy(ptr, ZSTR_VAL(fcc->calling_scope->name), ZSTR_LEN(fcc->calling_scope->name)); + ptr += ZSTR_LEN(fcc->calling_scope->name); memcpy(ptr, "::", sizeof("::") - 1); ptr += sizeof("::") - 1; memcpy(ptr, Z_STRVAL_P(callable), Z_STRLEN_P(callable) + 1); @@ -3267,7 +3267,7 @@ again: *callable_name = zend_string_alloc(Z_STRLEN_P(obj) + Z_STRLEN_P(method) + sizeof("::") - 1, 0); - ptr = (*callable_name)->val; + ptr = ZSTR_VAL(*callable_name); memcpy(ptr, Z_STRVAL_P(obj), Z_STRLEN_P(obj)); ptr += Z_STRLEN_P(obj); memcpy(ptr, "::", sizeof("::") - 1); @@ -3296,10 +3296,10 @@ again: if (callable_name) { char *ptr; - *callable_name = zend_string_alloc(fcc->calling_scope->name->len + Z_STRLEN_P(method) + sizeof("::") - 1, 0); - ptr = (*callable_name)->val; - memcpy(ptr, fcc->calling_scope->name->val, fcc->calling_scope->name->len); - ptr += fcc->calling_scope->name->len; + *callable_name = zend_string_alloc(ZSTR_LEN(fcc->calling_scope->name) + Z_STRLEN_P(method) + sizeof("::") - 1, 0); + ptr = ZSTR_VAL(*callable_name); + memcpy(ptr, ZSTR_VAL(fcc->calling_scope->name), ZSTR_LEN(fcc->calling_scope->name)); + ptr += ZSTR_LEN(fcc->calling_scope->name); memcpy(ptr, "::", sizeof("::") - 1); ptr += sizeof("::") - 1; memcpy(ptr, Z_STRVAL_P(method), Z_STRLEN_P(method) + 1); @@ -3349,9 +3349,9 @@ again: if (callable_name) { zend_class_entry *ce = Z_OBJCE_P(callable); /* TBFixed: what if it's overloaded? */ - *callable_name = zend_string_alloc(ce->name->len + sizeof("::__invoke") - 1, 0); - memcpy((*callable_name)->val, ce->name->val, ce->name->len); - memcpy((*callable_name)->val + ce->name->len, "::__invoke", sizeof("::__invoke")); + *callable_name = zend_string_alloc(ZSTR_LEN(ce->name) + sizeof("::__invoke") - 1, 0); + memcpy(ZSTR_VAL(*callable_name), ZSTR_VAL(ce->name), ZSTR_LEN(ce->name)); + memcpy(ZSTR_VAL(*callable_name) + ZSTR_LEN(ce->name), "::__invoke", sizeof("::__invoke")); } return 1; } @@ -3592,7 +3592,7 @@ ZEND_API const char *zend_get_module_version(const char *module_name) /* {{{ */ zend_module_entry *module; lname = zend_string_alloc(name_len, 0); - zend_str_tolower_copy(lname->val, module_name, name_len); + zend_str_tolower_copy(ZSTR_VAL(lname), module_name, name_len); module = zend_hash_find_ptr(&module_registry, lname); zend_string_free(lname); return module ? module->version : NULL; @@ -3659,10 +3659,10 @@ ZEND_API int zend_declare_property_ex(zend_class_entry *ce, zend_string *name, z if (access_type & ZEND_ACC_PUBLIC) { property_info->name = zend_string_copy(name); } else if (access_type & ZEND_ACC_PRIVATE) { - property_info->name = zend_mangle_property_name(ce->name->val, ce->name->len, name->val, name->len, ce->type & ZEND_INTERNAL_CLASS); + property_info->name = zend_mangle_property_name(ZSTR_VAL(ce->name), ZSTR_LEN(ce->name), ZSTR_VAL(name), ZSTR_LEN(name), ce->type & ZEND_INTERNAL_CLASS); } else { ZEND_ASSERT(access_type & ZEND_ACC_PROTECTED); - property_info->name = zend_mangle_property_name("*", 1, name->val, name->len, ce->type & ZEND_INTERNAL_CLASS); + property_info->name = zend_mangle_property_name("*", 1, ZSTR_VAL(name), ZSTR_LEN(name), ce->type & ZEND_INTERNAL_CLASS); } property_info->name = zend_new_interned_string(property_info->name); @@ -3807,7 +3807,7 @@ ZEND_API void zend_update_property_ex(zend_class_entry *scope, zval *object, zen EG(scope) = scope; if (!Z_OBJ_HT_P(object)->write_property) { - zend_error_noreturn(E_CORE_ERROR, "Property %s of class %s cannot be updated", name, Z_OBJCE_P(object)->name->val); + zend_error_noreturn(E_CORE_ERROR, "Property %s of class %s cannot be updated", name, ZSTR_VAL(Z_OBJCE_P(object)->name)); } ZVAL_STR(&property, name); Z_OBJ_HT_P(object)->write_property(object, &property, value, NULL); @@ -3824,7 +3824,7 @@ ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, const EG(scope) = scope; if (!Z_OBJ_HT_P(object)->write_property) { - zend_error_noreturn(E_CORE_ERROR, "Property %s of class %s cannot be updated", name, Z_OBJCE_P(object)->name->val); + zend_error_noreturn(E_CORE_ERROR, "Property %s of class %s cannot be updated", name, ZSTR_VAL(Z_OBJCE_P(object)->name)); } ZVAL_STRINGL(&property, name, name_length); Z_OBJ_HT_P(object)->write_property(object, &property, value, NULL); @@ -4002,7 +4002,7 @@ ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, const c EG(scope) = scope; if (!Z_OBJ_HT_P(object)->read_property) { - zend_error_noreturn(E_CORE_ERROR, "Property %s of class %s cannot be read", name, Z_OBJCE_P(object)->name->val); + zend_error_noreturn(E_CORE_ERROR, "Property %s of class %s cannot be read", name, ZSTR_VAL(Z_OBJCE_P(object)->name)); } ZVAL_STRINGL(&property, name, name_length); @@ -4099,8 +4099,8 @@ ZEND_API zend_string* zend_find_alias_name(zend_class_entry *ce, zend_string *na if ((alias_ptr = ce->trait_aliases)) { alias = *alias_ptr; while (alias) { - if (alias->alias->len == name->len && - !strncasecmp(name->val, alias->alias->val, alias->alias->len)) { + if (ZSTR_LEN(alias->alias) == ZSTR_LEN(name) && + !strncasecmp(ZSTR_VAL(name), ZSTR_VAL(alias->alias), ZSTR_LEN(alias->alias))) { return alias->alias; } alias_ptr++; @@ -4131,8 +4131,8 @@ ZEND_API zend_string *zend_resolve_method_name(zend_class_entry *ce, zend_functi if (!name) { return f->common.function_name; } - if (name->len == f->common.function_name->len && - !strncasecmp(name->val, f->common.function_name->val, f->common.function_name->len)) { + if (ZSTR_LEN(name) == ZSTR_LEN(f->common.function_name) && + !strncasecmp(ZSTR_VAL(name), ZSTR_VAL(f->common.function_name), ZSTR_LEN(f->common.function_name))) { return f->common.function_name; } return zend_find_alias_name(f->common.scope, name); diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c index 7ecc4dfb73..94168d113f 100644 --- a/Zend/zend_ast.c +++ b/Zend/zend_ast.c @@ -557,8 +557,8 @@ static void zend_ast_export_str(smart_str *str, zend_string *s) { size_t i; - for (i = 0; i < s->len; i++) { - unsigned char c = s->val[i]; + for (i = 0; i < ZSTR_LEN(s); i++) { + unsigned char c = ZSTR_VAL(s)[i]; if (c == '\'' || c == '\\') { smart_str_appendc(str, '\\'); smart_str_appendc(str, c); @@ -572,8 +572,8 @@ static void zend_ast_export_qstr(smart_str *str, char quote, zend_string *s) { size_t i; - for (i = 0; i < s->len; i++) { - unsigned char c = s->val[i]; + for (i = 0; i < ZSTR_LEN(s); i++) { + unsigned char c = ZSTR_VAL(s)[i]; if (c < ' ') { switch (c) { case '\n': @@ -879,7 +879,7 @@ static void zend_ast_export_zval(smart_str *str, zval *zv, int priority, int ind break; case IS_DOUBLE: key = zend_strpprintf(0, "%.*G", (int) EG(precision), Z_DVAL_P(zv)); - smart_str_appendl(str, key->val, key->len); + smart_str_appendl(str, ZSTR_VAL(key), ZSTR_LEN(key)); zend_string_release(key); break; case IS_STRING: @@ -1006,7 +1006,7 @@ tail_call: smart_str_appendc(str, '&'); } if (ast->kind != ZEND_AST_CLOSURE) { - smart_str_appendl(str, decl->name->val, decl->name->len); + smart_str_appendl(str, ZSTR_VAL(decl->name), ZSTR_LEN(decl->name)); } smart_str_appendc(str, '('); zend_ast_export_ex(str, decl->child[0], 0, indent); @@ -1043,7 +1043,7 @@ tail_call: } smart_str_appends(str, "class "); } - smart_str_appendl(str, decl->name->val, decl->name->len); + smart_str_appendl(str, ZSTR_VAL(decl->name), ZSTR_LEN(decl->name)); if (decl->child[0]) { smart_str_appends(str, " extends "); zend_ast_export_ns_name(str, decl->child[0], 0, indent); diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index 1cdee8ac63..88d669014a 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -528,7 +528,7 @@ ZEND_FUNCTION(strlen) ZEND_PARSE_PARAMETERS_END(); #endif - RETVAL_LONG(s->len); + RETVAL_LONG(ZSTR_LEN(s)); } /* }}} */ @@ -542,7 +542,7 @@ ZEND_FUNCTION(strcmp) return; } - RETURN_LONG(zend_binary_strcmp(s1->val, s1->len, s2->val, s2->len)); + RETURN_LONG(zend_binary_strcmp(ZSTR_VAL(s1), ZSTR_LEN(s1), ZSTR_VAL(s2), ZSTR_LEN(s2))); } /* }}} */ @@ -562,7 +562,7 @@ ZEND_FUNCTION(strncmp) RETURN_FALSE; } - RETURN_LONG(zend_binary_strncmp(s1->val, s1->len, s2->val, s2->len, len)); + RETURN_LONG(zend_binary_strncmp(ZSTR_VAL(s1), ZSTR_LEN(s1), ZSTR_VAL(s2), ZSTR_LEN(s2), len)); } /* }}} */ @@ -576,7 +576,7 @@ ZEND_FUNCTION(strcasecmp) return; } - RETURN_LONG(zend_binary_strcasecmp(s1->val, s1->len, s2->val, s2->len)); + RETURN_LONG(zend_binary_strcasecmp(ZSTR_VAL(s1), ZSTR_LEN(s1), ZSTR_VAL(s2), ZSTR_LEN(s2))); } /* }}} */ @@ -596,7 +596,7 @@ ZEND_FUNCTION(strncasecmp) RETURN_FALSE; } - RETURN_LONG(zend_binary_strncasecmp(s1->val, s1->len, s2->val, s2->len, len)); + RETURN_LONG(zend_binary_strncasecmp(ZSTR_VAL(s1), ZSTR_LEN(s1), ZSTR_VAL(s2), ZSTR_LEN(s2), len)); } /* }}} */ @@ -708,7 +708,7 @@ ZEND_FUNCTION(error_reporting) if (Z_TYPE_P(err) == IS_LONG) { EG(error_reporting) = Z_LVAL_P(err); } else { - EG(error_reporting) = atoi(p->value->val); + EG(error_reporting) = atoi(ZSTR_VAL(p->value)); } } while (0); } @@ -803,7 +803,7 @@ ZEND_FUNCTION(define) } /* class constant, check if there is name and make sure class is valid & exists */ - if (zend_memnstr(name->val, "::", sizeof("::") - 1, name->val + name->len)) { + if (zend_memnstr(ZSTR_VAL(name), "::", sizeof("::") - 1, ZSTR_VAL(name) + ZSTR_LEN(name))) { zend_error(E_WARNING, "Class constants cannot be defined or redefined"); RETURN_FALSE; } @@ -1166,7 +1166,7 @@ ZEND_FUNCTION(get_object_vars) if (zend_check_property_access(zobj, key) == SUCCESS) { /* Not separating references */ if (Z_REFCOUNTED_P(value)) Z_ADDREF_P(value); - if (key->val[0] == 0) { + if (ZSTR_VAL(key)[0] == 0) { const char *prop_name, *class_name; size_t prop_len; zend_unmangle_property_name_ex(key, &class_name, &prop_name, &prop_len); @@ -1189,11 +1189,11 @@ static int same_name(zend_string *key, zend_string *name) /* {{{ */ if (key == name) { return 1; } - if (key->len != name->len) { + if (ZSTR_LEN(key) != ZSTR_LEN(name)) { return 0; } lcname = zend_string_tolower(name); - ret = memcmp(lcname->val, key->val, key->len) == 0; + ret = memcmp(ZSTR_VAL(lcname), ZSTR_VAL(key), ZSTR_LEN(key)) == 0; zend_string_release(lcname); return ret; } @@ -1233,7 +1233,7 @@ ZEND_FUNCTION(get_class_methods) zend_check_protected(mptr->common.scope, EG(scope))) || ((mptr->common.fn_flags & ZEND_ACC_PRIVATE) && EG(scope) == mptr->common.scope)))) { - size_t len = mptr->common.function_name->len; + size_t len = ZSTR_LEN(mptr->common.function_name); /* Do not display old-style inherited constructors */ if (!key) { @@ -1241,7 +1241,7 @@ ZEND_FUNCTION(get_class_methods) zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), &method_name); } else if ((mptr->common.fn_flags & ZEND_ACC_CTOR) == 0 || mptr->common.scope == ce || - zend_binary_strcasecmp(key->val, key->len, mptr->common.function_name->val, len) == 0) { + zend_binary_strcasecmp(ZSTR_VAL(key), ZSTR_LEN(key), ZSTR_VAL(mptr->common.function_name), len) == 0) { if (mptr->type == ZEND_USER_FUNCTION && (!mptr->op_array.refcount || *mptr->op_array.refcount > 1) && @@ -1385,10 +1385,10 @@ ZEND_FUNCTION(class_exists) #endif if (!autoload) { - if (class_name->val[0] == '\\') { + if (ZSTR_VAL(class_name)[0] == '\\') { /* Ignore leading "\" */ - lc_name = zend_string_alloc(class_name->len - 1, 0); - zend_str_tolower_copy(lc_name->val, class_name->val + 1, class_name->len - 1); + lc_name = zend_string_alloc(ZSTR_LEN(class_name) - 1, 0); + zend_str_tolower_copy(ZSTR_VAL(lc_name), ZSTR_VAL(class_name) + 1, ZSTR_LEN(class_name) - 1); } else { lc_name = zend_string_tolower(class_name); } @@ -1428,10 +1428,10 @@ ZEND_FUNCTION(interface_exists) #endif if (!autoload) { - if (iface_name->val[0] == '\\') { + if (ZSTR_VAL(iface_name)[0] == '\\') { /* Ignore leading "\" */ - lc_name = zend_string_alloc(iface_name->len - 1, 0); - zend_str_tolower_copy(lc_name->val, iface_name->val + 1, iface_name->len - 1); + lc_name = zend_string_alloc(ZSTR_LEN(iface_name) - 1, 0); + zend_str_tolower_copy(ZSTR_VAL(lc_name), ZSTR_VAL(iface_name) + 1, ZSTR_LEN(iface_name) - 1); } else { lc_name = zend_string_tolower(iface_name); } @@ -1470,10 +1470,10 @@ ZEND_FUNCTION(trait_exists) #endif if (!autoload) { - if (trait_name->val[0] == '\\') { + if (ZSTR_VAL(trait_name)[0] == '\\') { /* Ignore leading "\" */ - lc_name = zend_string_alloc(trait_name->len - 1, 0); - zend_str_tolower_copy(lc_name->val, trait_name->val + 1, trait_name->len - 1); + lc_name = zend_string_alloc(ZSTR_LEN(trait_name) - 1, 0); + zend_str_tolower_copy(ZSTR_VAL(lc_name), ZSTR_VAL(trait_name) + 1, ZSTR_LEN(trait_name) - 1); } else { lc_name = zend_string_tolower(trait_name); } @@ -1510,10 +1510,10 @@ ZEND_FUNCTION(function_exists) ZEND_PARSE_PARAMETERS_END(); #endif - if (name->val[0] == '\\') { + if (ZSTR_VAL(name)[0] == '\\') { /* Ignore leading "\" */ - lcname = zend_string_alloc(name->len - 1, 0); - zend_str_tolower_copy(lcname->val, name->val + 1, name->len - 1); + lcname = zend_string_alloc(ZSTR_LEN(name) - 1, 0); + zend_str_tolower_copy(ZSTR_VAL(lcname), ZSTR_VAL(name) + 1, ZSTR_LEN(name) - 1); } else { lcname = zend_string_tolower(name); } @@ -1559,7 +1559,7 @@ ZEND_FUNCTION(class_alias) RETURN_FALSE; } } else { - zend_error(E_WARNING, "Class '%s' not found", class_name->val); + zend_error(E_WARNING, "Class '%s' not found", ZSTR_VAL(class_name)); RETURN_FALSE; } } @@ -1685,7 +1685,7 @@ ZEND_FUNCTION(set_error_handler) if (Z_TYPE_P(error_handler) != IS_NULL) { /* NULL == unset */ if (!zend_is_callable(error_handler, 0, &error_handler_name)) { zend_error(E_WARNING, "%s() expects the argument (%s) to be a valid callback", - get_active_function_name(), error_handler_name?error_handler_name->val:"unknown"); + get_active_function_name(), error_handler_name?ZSTR_VAL(error_handler_name):"unknown"); zend_string_release(error_handler_name); return; } @@ -1753,7 +1753,7 @@ ZEND_FUNCTION(set_exception_handler) if (Z_TYPE_P(exception_handler) != IS_NULL) { /* NULL == unset */ if (!zend_is_callable(exception_handler, 0, &exception_handler_name)) { zend_error(E_WARNING, "%s() expects the argument (%s) to be a valid callback", - get_active_function_name(), exception_handler_name?exception_handler_name->val:"unknown"); + get_active_function_name(), exception_handler_name?ZSTR_VAL(exception_handler_name):"unknown"); zend_string_release(exception_handler_name); return; } @@ -1805,7 +1805,7 @@ static int copy_class_or_interface_name(zval *el, int num_args, va_list args, ze uint32_t comply = va_arg(args, uint32_t); uint32_t comply_mask = (comply)? mask:0; - if ((hash_key->key && hash_key->key->val[0] != 0) + if ((hash_key->key && ZSTR_VAL(hash_key->key)[0] != 0) && (comply_mask == (ce->ce_flags & mask))) { if (ce->refcount > 1 && !same_name(hash_key->key, ce->name)) { @@ -1872,7 +1872,7 @@ static int copy_function_name(zval *zv, int num_args, va_list args, zend_hash_ke zval *internal_ar = va_arg(args, zval *), *user_ar = va_arg(args, zval *); - if (hash_key->key == NULL || hash_key->key->val[0] == 0) { + if (hash_key->key == NULL || ZSTR_VAL(hash_key->key)[0] == 0) { return 0; } @@ -1976,10 +1976,10 @@ ZEND_FUNCTION(create_function) func->static_variables = static_variables; function_name = zend_string_alloc(sizeof("0lambda_")+MAX_LENGTH_OF_LONG, 0); - function_name->val[0] = '\0'; + ZSTR_VAL(function_name)[0] = '\0'; do { - function_name->len = snprintf(function_name->val + 1, sizeof("lambda_")+MAX_LENGTH_OF_LONG, "lambda_%d", ++EG(lambda_count)) + 1; + ZSTR_LEN(function_name) = snprintf(ZSTR_VAL(function_name) + 1, sizeof("lambda_")+MAX_LENGTH_OF_LONG, "lambda_%d", ++EG(lambda_count)) + 1; } while (zend_hash_add_ptr(EG(function_table), function_name, func) == NULL); RETURN_NEW_STR(function_name); } else { @@ -2063,10 +2063,10 @@ ZEND_FUNCTION(get_resources) } } ZEND_HASH_FOREACH_END(); } else { - int id = zend_fetch_list_dtor_id(type->val); + int id = zend_fetch_list_dtor_id(ZSTR_VAL(type)); if (id <= 0) { - zend_error(E_WARNING, "get_resources(): Unknown resource type '%s'", type->val); + zend_error(E_WARNING, "get_resources(): Unknown resource type '%s'", ZSTR_VAL(type)); RETURN_FALSE; } @@ -2299,7 +2299,7 @@ ZEND_FUNCTION(debug_print_backtrace) } if (skip->func && ZEND_USER_CODE(skip->func->common.type)) { - filename = skip->func->op_array.filename->val; + filename = ZSTR_VAL(skip->func->op_array.filename); if (skip->opline->opcode == ZEND_HANDLE_EXCEPTION) { if (EG(opline_before_exception)) { lineno = EG(opline_before_exception)->lineno; @@ -2321,10 +2321,10 @@ ZEND_FUNCTION(debug_print_backtrace) func = call->func; function_name = (func->common.scope && func->common.scope->trait_aliases) ? - zend_resolve_method_name( - (object ? object->ce : func->common.scope), func)->val : + ZSTR_VAL(zend_resolve_method_name( + (object ? object->ce : func->common.scope), func)) : (func->common.function_name ? - func->common.function_name->val : NULL); + ZSTR_VAL(func->common.function_name) : NULL); } else { func = NULL; function_name = NULL; @@ -2393,7 +2393,7 @@ ZEND_FUNCTION(debug_print_backtrace) } zend_printf("#%-2d ", indent); if (class_name) { - ZEND_PUTS(class_name->val); + ZEND_PUTS(ZSTR_VAL(class_name)); ZEND_PUTS(call_type); } zend_printf("%s(", function_name); @@ -2415,7 +2415,7 @@ ZEND_FUNCTION(debug_print_backtrace) break; } if (prev->func && ZEND_USER_CODE(prev->func->common.type)) { - zend_printf(") called at [%s:%d]\n", prev->func->op_array.filename->val, prev->opline->lineno); + zend_printf(") called at [%s:%d]\n", ZSTR_VAL(prev->func->op_array.filename), prev->opline->lineno); break; } prev_call = prev; @@ -2493,7 +2493,7 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int } if (skip->func && ZEND_USER_CODE(skip->func->common.type)) { - filename = skip->func->op_array.filename->val; + filename = ZSTR_VAL(skip->func->op_array.filename); if (skip->opline->opcode == ZEND_HANDLE_EXCEPTION) { if (EG(opline_before_exception)) { lineno = EG(opline_before_exception)->lineno; @@ -2538,10 +2538,10 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int func = call->func; function_name = (func->common.scope && func->common.scope->trait_aliases) ? - zend_resolve_method_name( - (object ? object->ce : func->common.scope), func)->val : + ZSTR_VAL(zend_resolve_method_name( + (object ? object->ce : func->common.scope), func)) : (func->common.function_name ? - func->common.function_name->val : NULL); + ZSTR_VAL(func->common.function_name) : NULL); } else { func = NULL; function_name = NULL; @@ -2686,7 +2686,7 @@ ZEND_FUNCTION(get_extension_funcs) if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &extension_name) == FAILURE) { return; } - if (strncasecmp(extension_name->val, "zend", sizeof("zend"))) { + if (strncasecmp(ZSTR_VAL(extension_name), "zend", sizeof("zend"))) { lcname = zend_string_tolower(extension_name); } else { lcname = zend_string_init("core", sizeof("core")-1, 0); diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c index 865f8b1afb..7117968c37 100644 --- a/Zend/zend_closures.c +++ b/Zend/zend_closures.c @@ -98,7 +98,7 @@ ZEND_METHOD(Closure, call) /* verify that we aren't binding internal function to a wrong object */ if ((closure->func.common.fn_flags & ZEND_ACC_STATIC) == 0 && !instanceof_function(Z_OBJCE_P(newthis), closure->func.common.scope)) { - zend_error(E_WARNING, "Cannot bind function %s::%s to object of class %s", closure->func.common.scope->name->val, closure->func.common.function_name->val, Z_OBJCE_P(newthis)->name->val); + zend_error(E_WARNING, "Cannot bind function %s::%s to object of class %s", ZSTR_VAL(closure->func.common.scope->name), ZSTR_VAL(closure->func.common.function_name), ZSTR_VAL(Z_OBJCE_P(newthis)->name)); return; } } @@ -107,7 +107,7 @@ ZEND_METHOD(Closure, call) if (newobj->ce != closure->func.common.scope && newobj->ce->type == ZEND_INTERNAL_CLASS) { /* rebinding to internal class is not allowed */ - zend_error(E_WARNING, "Cannot bind closure to object of internal class %s", newobj->ce->name->val); + zend_error(E_WARNING, "Cannot bind closure to object of internal class %s", ZSTR_VAL(newobj->ce->name)); return; } @@ -171,7 +171,7 @@ ZEND_METHOD(Closure, bind) 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) { - zend_error(E_WARNING, "Class '%s' not found", class_name->val); + zend_error(E_WARNING, "Class '%s' not found", ZSTR_VAL(class_name)); zend_string_release(class_name); RETURN_NULL(); } @@ -179,7 +179,7 @@ ZEND_METHOD(Closure, bind) } if(ce && ce != closure->func.common.scope && ce->type == ZEND_INTERNAL_CLASS) { /* rebinding to internal class is not allowed */ - zend_error(E_WARNING, "Cannot bind closure to scope of internal class %s", ce->name->val); + zend_error(E_WARNING, "Cannot bind closure to scope of internal class %s", ZSTR_VAL(ce->name)); return; } } else { /* scope argument not given; do not change the scope by default */ @@ -417,7 +417,7 @@ static HashTable *zend_closure_get_debug_info(zval *object, int *is_temp) /* {{{ if (arg_info->name) { name = zend_strpprintf(0, "%s$%s", arg_info->pass_by_reference ? "&" : "", - arg_info->name->val); + ZSTR_VAL(arg_info->name)); } else { name = zend_strpprintf(0, "%s$param%d", arg_info->pass_by_reference ? "&" : "", @@ -544,12 +544,12 @@ ZEND_API void zend_create_closure(zval *res, zend_function *func, zend_class_ent /* verify that we aren't binding internal function to a wrong scope */ if(func->common.scope != NULL) { if(scope && !instanceof_function(scope, func->common.scope)) { - zend_error(E_WARNING, "Cannot bind function %s::%s to scope class %s", func->common.scope->name->val, func->common.function_name->val, scope->name->val); + zend_error(E_WARNING, "Cannot bind function %s::%s to scope class %s", ZSTR_VAL(func->common.scope->name), ZSTR_VAL(func->common.function_name), ZSTR_VAL(scope->name)); scope = NULL; } if(scope && this_ptr && (func->common.fn_flags & ZEND_ACC_STATIC) == 0 && !instanceof_function(Z_OBJCE_P(this_ptr), closure->func.common.scope)) { - zend_error(E_WARNING, "Cannot bind function %s::%s to object of class %s", func->common.scope->name->val, func->common.function_name->val, Z_OBJCE_P(this_ptr)->name->val); + zend_error(E_WARNING, "Cannot bind function %s::%s to object of class %s", ZSTR_VAL(func->common.scope->name), ZSTR_VAL(func->common.function_name), ZSTR_VAL(Z_OBJCE_P(this_ptr)->name)); scope = NULL; this_ptr = NULL; } diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index e24c3ca9b3..364f84e0c4 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -106,18 +106,18 @@ static zend_string *zend_build_runtime_definition_key(zend_string *name, unsigne zend_string *filename = CG(active_op_array)->filename; /* NULL, name length, filename length, last accepting char position length */ - result = zend_string_alloc(1 + name->len + filename->len + char_pos_len, 0); - sprintf(result->val, "%c%s%s%s", '\0', name->val, filename->val, char_pos_buf); + result = zend_string_alloc(1 + ZSTR_LEN(name) + ZSTR_LEN(filename) + char_pos_len, 0); + sprintf(ZSTR_VAL(result), "%c%s%s%s", '\0', ZSTR_VAL(name), ZSTR_VAL(filename), char_pos_buf); return zend_new_interned_string(result); } /* }}} */ static zend_bool zend_get_unqualified_name(const zend_string *name, const char **result, size_t *result_len) /* {{{ */ { - const char *ns_separator = zend_memrchr(name->val, '\\', name->len); + const char *ns_separator = zend_memrchr(ZSTR_VAL(name), '\\', ZSTR_LEN(name)); if (ns_separator != NULL) { *result = ns_separator + 1; - *result_len = name->val + name->len - *result; + *result_len = ZSTR_VAL(name) + ZSTR_LEN(name) - *result; return 1; } @@ -147,8 +147,8 @@ static zend_bool zend_is_reserved_class_name(const zend_string *name) /* {{{ */ { const struct reserved_class_name *reserved = reserved_class_names; - const char *uqname = name->val; - size_t uqname_len = name->len; + const char *uqname = ZSTR_VAL(name); + size_t uqname_len = ZSTR_LEN(name); zend_get_unqualified_name(name, &uqname, &uqname_len); for (; reserved->name; ++reserved) { @@ -167,7 +167,7 @@ ZEND_API void zend_assert_valid_class_name(const zend_string *name) /* {{{ */ { if (zend_is_reserved_class_name(name)) { zend_error_noreturn(E_COMPILE_ERROR, - "Cannot use '%s' as class name as it is reserved", name->val); + "Cannot use '%s' as class name as it is reserved", ZSTR_VAL(name)); } } /* }}} */ @@ -192,8 +192,8 @@ static zend_always_inline zend_uchar zend_lookup_builtin_type_by_name(const zend const builtin_type_info *info = &builtin_types[0]; for (; info->name; ++info) { - if (name->len == info->name_len - && zend_binary_strcasecmp(name->val, name->len, info->name, info->name_len) == 0 + if (ZSTR_LEN(name) == info->name_len + && zend_binary_strcasecmp(ZSTR_VAL(name), ZSTR_LEN(name), info->name, info->name_len) == 0 ) { return info->type; } @@ -375,10 +375,10 @@ static int lookup_cv(zend_op_array *op_array, zend_string* name) /* {{{ */{ zend_ulong hash_value = zend_string_hash_val(name); while (i < op_array->last_var) { - if (op_array->vars[i]->val == name->val || - (op_array->vars[i]->h == hash_value && - op_array->vars[i]->len == name->len && - memcmp(op_array->vars[i]->val, name->val, name->len) == 0)) { + if (ZSTR_VAL(op_array->vars[i]) == ZSTR_VAL(name) || + (ZSTR_H(op_array->vars[i]) == hash_value && + ZSTR_LEN(op_array->vars[i]) == ZSTR_LEN(name) && + memcmp(ZSTR_VAL(op_array->vars[i]), ZSTR_VAL(name), ZSTR_LEN(name)) == 0)) { zend_string_release(name); return (int)(zend_intptr_t)ZEND_CALL_VAR_NUM(NULL, i); } @@ -479,7 +479,7 @@ static int zend_add_ns_func_name_literal(zend_op_array *op_array, zend_string *n /* Lowercased unqualfied name */ if (zend_get_unqualified_name(name, &unqualified_name, &unqualified_name_len)) { lc_name = zend_string_alloc(unqualified_name_len, 0); - zend_str_tolower_copy(lc_name->val, unqualified_name, unqualified_name_len); + zend_str_tolower_copy(ZSTR_VAL(lc_name), unqualified_name, unqualified_name_len); zend_add_literal_string(op_array, &lc_name); } @@ -508,16 +508,16 @@ static int zend_add_const_name_literal(zend_op_array *op_array, zend_string *nam int ret = zend_add_literal_string(op_array, &name); - size_t ns_len = 0, after_ns_len = name->len; - const char *after_ns = zend_memrchr(name->val, '\\', name->len); + size_t ns_len = 0, after_ns_len = ZSTR_LEN(name); + const char *after_ns = zend_memrchr(ZSTR_VAL(name), '\\', ZSTR_LEN(name)); if (after_ns) { after_ns += 1; - ns_len = after_ns - name->val - 1; - after_ns_len = name->len - ns_len - 1; + ns_len = after_ns - ZSTR_VAL(name) - 1; + after_ns_len = ZSTR_LEN(name) - ns_len - 1; /* lowercased namespace name & original constant name */ - tmp_name = zend_string_init(name->val, name->len, 0); - zend_str_tolower(tmp_name->val, ns_len); + tmp_name = zend_string_init(ZSTR_VAL(name), ZSTR_LEN(name), 0); + zend_str_tolower(ZSTR_VAL(tmp_name), ns_len); zend_add_literal_string(op_array, &tmp_name); /* lowercased namespace name & lowercased constant name */ @@ -528,7 +528,7 @@ static int zend_add_const_name_literal(zend_op_array *op_array, zend_string *nam return ret; } } else { - after_ns = name->val; + after_ns = ZSTR_VAL(name); } /* original unqualified constant name */ @@ -537,7 +537,7 @@ static int zend_add_const_name_literal(zend_op_array *op_array, zend_string *nam /* lowercased unqualified constant name */ tmp_name = zend_string_alloc(after_ns_len, 0); - zend_str_tolower_copy(tmp_name->val, after_ns, after_ns_len); + zend_str_tolower_copy(ZSTR_VAL(tmp_name), after_ns, after_ns_len); zend_add_literal_string(op_array, &tmp_name); return ret; @@ -699,10 +699,10 @@ zend_string *zend_concat3(char *str1, size_t str1_len, char *str2, size_t str2_l size_t len = str1_len + str2_len + str3_len; zend_string *res = zend_string_alloc(len, 0); - memcpy(res->val, str1, str1_len); - memcpy(res->val + str1_len, str2, str2_len); - memcpy(res->val + str1_len + str2_len, str3, str3_len); - res->val[len] = '\0'; + memcpy(ZSTR_VAL(res), str1, str1_len); + memcpy(ZSTR_VAL(res) + str1_len, str2, str2_len); + memcpy(ZSTR_VAL(res) + str1_len + str2_len, str3, str3_len); + ZSTR_VAL(res)[len] = '\0'; return res; } @@ -714,7 +714,7 @@ zend_string *zend_concat_names(char *name1, size_t name1_len, char *name2, size_ zend_string *zend_prefix_with_ns(zend_string *name) { if (FC(current_namespace)) { zend_string *ns = FC(current_namespace); - return zend_concat_names(ns->val, ns->len, name->val, name->len); + return zend_concat_names(ZSTR_VAL(ns), ZSTR_LEN(ns), ZSTR_VAL(name), ZSTR_LEN(name)); } else { return zend_string_copy(name); } @@ -726,7 +726,7 @@ void *zend_hash_find_ptr_lc(HashTable *ht, const char *str, size_t len) { ALLOCA_FLAG(use_heap); ZSTR_ALLOCA_ALLOC(lcname, len, use_heap); - zend_str_tolower_copy(lcname->val, str, len); + zend_str_tolower_copy(ZSTR_VAL(lcname), str, len); result = zend_hash_find_ptr(ht, lcname); ZSTR_ALLOCA_FREE(lcname, use_heap); @@ -740,9 +740,9 @@ zend_string *zend_resolve_non_class_name( char *compound; *is_fully_qualified = 0; - if (name->val[0] == '\\') { + if (ZSTR_VAL(name)[0] == '\\') { /* Remove \ prefix (only relevant if this is a string rather than a label) */ - return zend_string_init(name->val + 1, name->len - 1, 0); + return zend_string_init(ZSTR_VAL(name) + 1, ZSTR_LEN(name) - 1, 0); } if (type == ZEND_NAME_FQ) { @@ -761,7 +761,7 @@ zend_string *zend_resolve_non_class_name( if (case_sensitive) { import_name = zend_hash_find_ptr(current_import_sub, name); } else { - import_name = zend_hash_find_ptr_lc(current_import_sub, name->val, name->len); + import_name = zend_hash_find_ptr_lc(current_import_sub, ZSTR_VAL(name), ZSTR_LEN(name)); } if (import_name) { @@ -770,19 +770,19 @@ zend_string *zend_resolve_non_class_name( } } - compound = memchr(name->val, '\\', name->len); + compound = memchr(ZSTR_VAL(name), '\\', ZSTR_LEN(name)); if (compound) { *is_fully_qualified = 1; } if (compound && FC(imports)) { /* If the first part of a qualified name is an alias, substitute it. */ - size_t len = compound - name->val; - zend_string *import_name = zend_hash_find_ptr_lc(FC(imports), name->val, len); + size_t len = compound - ZSTR_VAL(name); + zend_string *import_name = zend_hash_find_ptr_lc(FC(imports), ZSTR_VAL(name), len); if (import_name) { return zend_concat_names( - import_name->val, import_name->len, name->val + len + 1, name->len - len - 1); + ZSTR_VAL(import_name), ZSTR_LEN(import_name), ZSTR_VAL(name) + len + 1, ZSTR_LEN(name) - len - 1); } } @@ -811,36 +811,36 @@ zend_string *zend_resolve_class_name(zend_string *name, uint32_t type) /* {{{ */ return zend_prefix_with_ns(name); } - if (type == ZEND_NAME_FQ || name->val[0] == '\\') { + if (type == ZEND_NAME_FQ || ZSTR_VAL(name)[0] == '\\') { /* Remove \ prefix (only relevant if this is a string rather than a label) */ - if (name->val[0] == '\\') { - name = zend_string_init(name->val + 1, name->len - 1, 0); + if (ZSTR_VAL(name)[0] == '\\') { + name = zend_string_init(ZSTR_VAL(name) + 1, ZSTR_LEN(name) - 1, 0); } else { zend_string_addref(name); } /* Ensure that \self, \parent and \static are not used */ if (ZEND_FETCH_CLASS_DEFAULT != zend_get_class_fetch_type(name)) { - zend_error_noreturn(E_COMPILE_ERROR, "'\\%s' is an invalid class name", name->val); + zend_error_noreturn(E_COMPILE_ERROR, "'\\%s' is an invalid class name", ZSTR_VAL(name)); } return name; } if (FC(imports)) { - compound = memchr(name->val, '\\', name->len); + compound = memchr(ZSTR_VAL(name), '\\', ZSTR_LEN(name)); if (compound) { /* If the first part of a qualified name is an alias, substitute it. */ - size_t len = compound - name->val; + size_t len = compound - ZSTR_VAL(name); zend_string *import_name = - zend_hash_find_ptr_lc(FC(imports), name->val, len); + zend_hash_find_ptr_lc(FC(imports), ZSTR_VAL(name), len); if (import_name) { return zend_concat_names( - import_name->val, import_name->len, name->val + len + 1, name->len - len - 1); + ZSTR_VAL(import_name), ZSTR_LEN(import_name), ZSTR_VAL(name) + len + 1, ZSTR_LEN(name) - len - 1); } } else { /* If an unqualified name is an alias, replace it. */ zend_string *import_name - = zend_hash_find_ptr_lc(FC(imports), name->val, name->len); + = zend_hash_find_ptr_lc(FC(imports), ZSTR_VAL(name), ZSTR_LEN(name)); if (import_name) { return zend_string_copy(import_name); @@ -1017,11 +1017,11 @@ ZEND_API int do_bind_function(const zend_op_array *op_array, const zend_op *opli && old_function->type == ZEND_USER_FUNCTION && old_function->op_array.last > 0) { zend_error_noreturn(error_level, "Cannot redeclare %s() (previously declared in %s:%d)", - function->common.function_name->val, - old_function->op_array.filename->val, + ZSTR_VAL(function->common.function_name), + ZSTR_VAL(old_function->op_array.filename), old_function->op_array.opcodes[0].lineno); } else { - zend_error_noreturn(error_level, "Cannot redeclare %s()", function->common.function_name->val); + zend_error_noreturn(error_level, "Cannot redeclare %s()", ZSTR_VAL(function->common.function_name)); } return FAILURE; } else { @@ -1059,7 +1059,7 @@ ZEND_API zend_class_entry *do_bind_class(const zend_op_array* op_array, const ze * so we shut up about it. This allows the if (!defined('FOO')) { return; } * approach to work. */ - zend_error_noreturn(E_COMPILE_ERROR, "Cannot declare %s %s, because the name is already in use", zend_get_object_type(ce), ce->name->val); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot declare %s %s, because the name is already in use", zend_get_object_type(ce), ZSTR_VAL(ce->name)); } return NULL; } else { @@ -1099,7 +1099,7 @@ ZEND_API zend_class_entry *do_bind_inherited_class(const zend_op_array *op_array } if (zend_hash_exists(class_table, Z_STR_P(op2))) { - zend_error_noreturn(E_COMPILE_ERROR, "Cannot declare %s %s, because the name is already in use", zend_get_object_type(ce), ce->name->val); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot declare %s %s, because the name is already in use", zend_get_object_type(ce), ZSTR_VAL(ce->name)); } zend_do_inheritance(ce, parent_ce); @@ -1108,7 +1108,7 @@ ZEND_API zend_class_entry *do_bind_inherited_class(const zend_op_array *op_array /* Register the derived class */ if (zend_hash_add_ptr(class_table, Z_STR_P(op2), ce) == NULL) { - zend_error_noreturn(E_COMPILE_ERROR, "Cannot declare %s %s, because the name is already in use", zend_get_object_type(ce), ce->name->val); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot declare %s %s, because the name is already in use", zend_get_object_type(ce), ZSTR_VAL(ce->name)); } return ce; } @@ -1213,9 +1213,9 @@ ZEND_API zend_string *zend_mangle_property_name(const char *src1, size_t src1_le size_t prop_name_length = 1 + src1_length + 1 + src2_length; zend_string *prop_name = zend_string_alloc(prop_name_length, internal); - prop_name->val[0] = '\0'; - memcpy(prop_name->val + 1, src1, src1_length+1); - memcpy(prop_name->val + 1 + src1_length + 1, src2, src2_length+1); + ZSTR_VAL(prop_name)[0] = '\0'; + memcpy(ZSTR_VAL(prop_name) + 1, src1, src1_length+1); + memcpy(ZSTR_VAL(prop_name) + 1 + src1_length + 1, src2, src2_length+1); return prop_name; } /* }}} */ @@ -1234,36 +1234,36 @@ ZEND_API int zend_unmangle_property_name_ex(const zend_string *name, const char *class_name = NULL; - if (name->val[0] != '\0') { - *prop_name = name->val; + if (ZSTR_VAL(name)[0] != '\0') { + *prop_name = ZSTR_VAL(name); if (prop_len) { - *prop_len = name->len; + *prop_len = ZSTR_LEN(name); } return SUCCESS; } - if (name->len < 3 || name->val[1] == '\0') { + if (ZSTR_LEN(name) < 3 || ZSTR_VAL(name)[1] == '\0') { zend_error(E_NOTICE, "Illegal member variable name"); - *prop_name = name->val; + *prop_name = ZSTR_VAL(name); if (prop_len) { - *prop_len = name->len; + *prop_len = ZSTR_LEN(name); } return FAILURE; } - class_name_len = zend_strnlen(name->val + 1, name->len - 2); - if (class_name_len >= name->len - 2 || name->val[class_name_len + 1] != '\0') { + class_name_len = zend_strnlen(ZSTR_VAL(name) + 1, ZSTR_LEN(name) - 2); + if (class_name_len >= ZSTR_LEN(name) - 2 || ZSTR_VAL(name)[class_name_len + 1] != '\0') { zend_error(E_NOTICE, "Corrupt member variable name"); - *prop_name = name->val; + *prop_name = ZSTR_VAL(name); if (prop_len) { - *prop_len = name->len; + *prop_len = ZSTR_LEN(name); } return FAILURE; } - *class_name = name->val + 1; - *prop_name = name->val + class_name_len + 2; + *class_name = ZSTR_VAL(name) + 1; + *prop_name = ZSTR_VAL(name) + class_name_len + 2; if (prop_len) { - *prop_len = name->len - class_name_len - 2; + *prop_len = ZSTR_LEN(name) - class_name_len - 2; } return SUCCESS; } @@ -1295,8 +1295,8 @@ static zend_bool zend_try_ct_eval_const(zval *zv, zend_string *name, zend_bool i { /* Substitute true, false and null (including unqualified usage in namespaces) */ - const char *lookup_name = name->val; - size_t lookup_len = name->len; + const char *lookup_name = ZSTR_VAL(name); + size_t lookup_len = ZSTR_LEN(name); if (!is_fully_qualified) { zend_get_unqualified_name(name, &lookup_name, &lookup_len); @@ -1434,7 +1434,7 @@ static zend_bool zend_try_ct_eval_class_const(zval *zv, zend_string *class_name, if (class_name_refers_to_active_ce(class_name, fetch_type)) { c = zend_hash_find(&CG(active_class_entry)->constants_table, name); } else if (fetch_type == ZEND_FETCH_CLASS_DEFAULT && !(CG(compiler_options) & ZEND_COMPILE_NO_CONSTANT_SUBSTITUTION)) { - zend_class_entry *ce = zend_hash_find_ptr_lc(CG(class_table), class_name->val, class_name->len); + zend_class_entry *ce = zend_hash_find_ptr_lc(CG(class_table), ZSTR_VAL(class_name), ZSTR_LEN(class_name)); if (ce) { c = zend_hash_find(&ce->constants_table, name); } else { @@ -1708,13 +1708,13 @@ zend_ast *zend_ast_append_str(zend_ast *left_ast, zend_ast *right_ast) /* {{{ */ zend_string *right = zend_ast_get_str(right_ast); zend_string *result; - size_t left_len = left->len; - size_t len = left_len + right->len + 1; /* left\right */ + size_t left_len = ZSTR_LEN(left); + size_t len = left_len + ZSTR_LEN(right) + 1; /* left\right */ result = zend_string_extend(left, len, 0); - result->val[left_len] = '\\'; - memcpy(&result->val[left_len + 1], right->val, right->len); - result->val[len] = '\0'; + ZSTR_VAL(result)[left_len] = '\\'; + memcpy(&ZSTR_VAL(result)[left_len + 1], ZSTR_VAL(right), ZSTR_LEN(right)); + ZSTR_VAL(result)[len] = '\0'; zend_string_release(right); ZVAL_STR(left_zv, result); @@ -2868,9 +2868,9 @@ void zend_compile_dynamic_call(znode *result, znode *name_node, zend_ast *args_a if (name_node->op_type == IS_CONST && Z_TYPE(name_node->u.constant) == IS_STRING) { const char *colon; zend_string *str = Z_STR(name_node->u.constant); - if ((colon = zend_memrchr(str->val, ':', str->len)) != NULL && colon > str->val && *(colon - 1) == ':') { - zend_string *class = zend_string_init(str->val, colon - str->val - 1, 0); - zend_string *method = zend_string_init(colon + 1, str->len - (colon - str->val) - 1, 0); + if ((colon = zend_memrchr(ZSTR_VAL(str), ':', ZSTR_LEN(str))) != NULL && colon > ZSTR_VAL(str) && *(colon - 1) == ':') { + zend_string *class = zend_string_init(ZSTR_VAL(str), colon - ZSTR_VAL(str) - 1, 0); + zend_string *method = zend_string_init(colon + 1, ZSTR_LEN(str) - (colon - ZSTR_VAL(str)) - 1, 0); opline->opcode = ZEND_INIT_STATIC_METHOD_CALL; opline->op1_type = IS_CONST; opline->op1.constant = zend_add_class_name_literal(CG(active_op_array), class); @@ -2955,7 +2955,7 @@ int zend_compile_func_defined(znode *result, zend_ast_list *args) /* {{{ */ } name = zval_get_string(zend_ast_get_zval(args->child[0])); - if (zend_memrchr(name->val, '\\', name->len) || zend_memrchr(name->val, ':', name->len)) { + if (zend_memrchr(ZSTR_VAL(name), '\\', ZSTR_LEN(name)) || zend_memrchr(ZSTR_VAL(name), ':', ZSTR_LEN(name))) { zend_string_release(name); return FAILURE; } @@ -3655,7 +3655,7 @@ void zend_compile_label(zend_ast *ast) /* {{{ */ dest.opline_num = get_next_op_number(CG(active_op_array)); if (!zend_hash_add_mem(CG(context).labels, label, &dest, sizeof(zend_label))) { - zend_error_noreturn(E_COMPILE_ERROR, "Label '%s' already defined", label->val); + zend_error_noreturn(E_COMPILE_ERROR, "Label '%s' already defined", ZSTR_VAL(label)); } } /* }}} */ @@ -4098,9 +4098,9 @@ void zend_handle_encoding_declaration(zend_ast *ast) /* {{{ */ CG(encoding_declared) = 1; - new_encoding = zend_multibyte_fetch_encoding(encoding_name->val); + new_encoding = zend_multibyte_fetch_encoding(ZSTR_VAL(encoding_name)); if (!new_encoding) { - zend_error(E_COMPILE_WARNING, "Unsupported encoding [%s]", encoding_name->val); + zend_error(E_COMPILE_WARNING, "Unsupported encoding [%s]", ZSTR_VAL(encoding_name)); } else { old_input_filter = LANG_SCNG(input_filter); old_encoding = LANG_SCNG(script_encoding); @@ -4193,7 +4193,7 @@ void zend_compile_declare(zend_ast *ast) /* {{{ */ } } else { - zend_error(E_COMPILE_WARNING, "Unsupported declare '%s'", name->val); + zend_error(E_COMPILE_WARNING, "Unsupported declare '%s'", ZSTR_VAL(name)); } } @@ -4311,7 +4311,7 @@ void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast) /* {{{ */ if (zend_is_auto_global(name)) { zend_error_noreturn(E_COMPILE_ERROR, "Cannot re-assign auto-global variable %s", - name->val); + ZSTR_VAL(name)); } var_node.op_type = IS_CV; @@ -4319,7 +4319,7 @@ void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast) /* {{{ */ if (EX_VAR_TO_NUM(var_node.u.op.var) != i) { zend_error_noreturn(E_COMPILE_ERROR, "Redefinition of parameter $%s", - name->val); + ZSTR_VAL(name)); } else if (zend_string_equals_literal(name, "this")) { if (op_array->scope && (op_array->fn_flags & ZEND_ACC_STATIC) == 0) { zend_error_noreturn(E_COMPILE_ERROR, "Cannot re-assign $this"); @@ -4477,7 +4477,7 @@ void zend_begin_method_decl(zend_op_array *op_array, zend_string *name, zend_boo if (in_interface) { if ((op_array->fn_flags & ZEND_ACC_PPP_MASK) != ZEND_ACC_PUBLIC) { zend_error_noreturn(E_COMPILE_ERROR, "Access type for interface method " - "%s::%s() must be omitted", ce->name->val, name->val); + "%s::%s() must be omitted", ZSTR_VAL(ce->name), ZSTR_VAL(name)); } op_array->fn_flags |= ZEND_ACC_ABSTRACT; } @@ -4485,18 +4485,18 @@ void zend_begin_method_decl(zend_op_array *op_array, zend_string *name, zend_boo if (op_array->fn_flags & ZEND_ACC_ABSTRACT) { if (op_array->fn_flags & ZEND_ACC_PRIVATE) { zend_error_noreturn(E_COMPILE_ERROR, "%s function %s::%s() cannot be declared private", - in_interface ? "Interface" : "Abstract", ce->name->val, name->val); + in_interface ? "Interface" : "Abstract", ZSTR_VAL(ce->name), ZSTR_VAL(name)); } if (has_body) { zend_error_noreturn(E_COMPILE_ERROR, "%s function %s::%s() cannot contain body", - in_interface ? "Interface" : "Abstract", ce->name->val, name->val); + in_interface ? "Interface" : "Abstract", ZSTR_VAL(ce->name), ZSTR_VAL(name)); } ce->ce_flags |= ZEND_ACC_IMPLICIT_ABSTRACT_CLASS; } else if (!has_body) { zend_error_noreturn(E_COMPILE_ERROR, "Non-abstract method %s::%s() must contain body", - ce->name->val, name->val); + ZSTR_VAL(ce->name), ZSTR_VAL(name)); } op_array->scope = ce; @@ -4507,7 +4507,7 @@ void zend_begin_method_decl(zend_op_array *op_array, zend_string *name, zend_boo if (zend_hash_add_ptr(&ce->function_table, lcname, op_array) == NULL) { zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare %s::%s()", - ce->name->val, name->val); + ZSTR_VAL(ce->name), ZSTR_VAL(name)); } if (in_interface) { @@ -4648,7 +4648,7 @@ static void zend_begin_func_decl(znode *result, zend_op_array *op_array, zend_as zend_string *import_name = zend_hash_find_ptr(FC(imports_function), lcname); if (import_name && !zend_string_equals_ci(lcname, import_name)) { zend_error_noreturn(E_COMPILE_ERROR, "Cannot declare function %s " - "because the name is already in use", name->val); + "because the name is already in use", ZSTR_VAL(name)); } } @@ -4786,12 +4786,12 @@ void zend_compile_prop_decl(zend_ast *ast) /* {{{ */ if (flags & ZEND_ACC_FINAL) { zend_error_noreturn(E_COMPILE_ERROR, "Cannot declare property %s::$%s final, " "the final modifier is allowed only for methods and classes", - ce->name->val, name->val); + ZSTR_VAL(ce->name), ZSTR_VAL(name)); } if (zend_hash_exists(&ce->properties_info, name)) { zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare %s::$%s", - ce->name->val, name->val); + ZSTR_VAL(ce->name), ZSTR_VAL(name)); } if (value_ast) { @@ -4837,7 +4837,7 @@ void zend_compile_class_const_decl(zend_ast *ast) /* {{{ */ name = zend_new_interned_string_safe(name); if (zend_hash_add(&ce->constants_table, name, &value_zv) == NULL) { zend_error_noreturn(E_COMPILE_ERROR, "Cannot redefine class constant %s::%s", - ce->name->val, name->val); + ZSTR_VAL(ce->name), ZSTR_VAL(name)); } if (Z_CONSTANT(value_zv)) { @@ -4941,7 +4941,7 @@ void zend_compile_use_trait(zend_ast *ast) /* {{{ */ if (ce->ce_flags & ZEND_ACC_INTERFACE) { zend_error_noreturn(E_COMPILE_ERROR, "Cannot use traits inside of interfaces. " - "%s is used in %s", name->val, ce->name->val); + "%s is used in %s", ZSTR_VAL(name), ZSTR_VAL(ce->name)); } switch (zend_get_class_fetch_type(name)) { @@ -4949,7 +4949,7 @@ void zend_compile_use_trait(zend_ast *ast) /* {{{ */ case ZEND_FETCH_CLASS_PARENT: case ZEND_FETCH_CLASS_STATIC: zend_error_noreturn(E_COMPILE_ERROR, "Cannot use '%s' as trait name " - "as it is reserved", name->val); + "as it is reserved", ZSTR_VAL(name)); break; } @@ -4994,7 +4994,7 @@ void zend_compile_implements(znode *class_node, zend_ast *ast) /* {{{ */ if (!zend_is_const_default_class_ref(class_ast)) { zend_error_noreturn(E_COMPILE_ERROR, - "Cannot use '%s' as interface name as it is reserved", name->val); + "Cannot use '%s' as interface name as it is reserved", ZSTR_VAL(name)); } opline = zend_emit_op(NULL, ZEND_ADD_INTERFACE, class_node, NULL); @@ -5015,8 +5015,8 @@ static zend_string *zend_generate_anon_class_name(unsigned char *lex_pos) /* {{{ zend_string *filename = CG(active_op_array)->filename; /* NULL, name length, filename length, last accepting char position length */ - result = zend_string_alloc(sizeof("class@anonymous") + filename->len + char_pos_len, 0); - sprintf(result->val, "class@anonymous%c%s%s", '\0', filename->val, char_pos_buf); + result = zend_string_alloc(sizeof("class@anonymous") + ZSTR_LEN(filename) + char_pos_len, 0); + sprintf(ZSTR_VAL(result), "class@anonymous%c%s%s", '\0', ZSTR_VAL(filename), char_pos_buf); return zend_new_interned_string(result); } /* }}} */ @@ -5057,7 +5057,7 @@ void zend_compile_class_decl(zend_ast *ast) /* {{{ */ if (import_name && !zend_string_equals_ci(lcname, import_name)) { zend_error_noreturn(E_COMPILE_ERROR, "Cannot declare class %s " - "because the name is already in use", name->val); + "because the name is already in use", ZSTR_VAL(name)); } name = zend_new_interned_string(name); @@ -5089,7 +5089,7 @@ void zend_compile_class_decl(zend_ast *ast) /* {{{ */ if (!zend_is_const_default_class_ref(extends_ast)) { zend_string *extends_name = zend_ast_get_str(extends_ast); zend_error_noreturn(E_COMPILE_ERROR, - "Cannot use '%s' as class name as it is reserved", extends_name->val); + "Cannot use '%s' as class name as it is reserved", ZSTR_VAL(extends_name)); } zend_compile_class_ref(&extends_node, extends_ast, 0); @@ -5150,34 +5150,34 @@ void zend_compile_class_decl(zend_ast *ast) /* {{{ */ ce->constructor->common.fn_flags |= ZEND_ACC_CTOR; if (ce->constructor->common.fn_flags & ZEND_ACC_STATIC) { zend_error_noreturn(E_COMPILE_ERROR, "Constructor %s::%s() cannot be static", - ce->name->val, ce->constructor->common.function_name->val); + ZSTR_VAL(ce->name), ZSTR_VAL(ce->constructor->common.function_name)); } if (ce->constructor->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) { zend_error_noreturn(E_COMPILE_ERROR, "Constructor %s::%s() cannot declare a return type", - ce->name->val, ce->constructor->common.function_name->val); + ZSTR_VAL(ce->name), ZSTR_VAL(ce->constructor->common.function_name)); } } if (ce->destructor) { ce->destructor->common.fn_flags |= ZEND_ACC_DTOR; if (ce->destructor->common.fn_flags & ZEND_ACC_STATIC) { zend_error_noreturn(E_COMPILE_ERROR, "Destructor %s::%s() cannot be static", - ce->name->val, ce->destructor->common.function_name->val); + ZSTR_VAL(ce->name), ZSTR_VAL(ce->destructor->common.function_name)); } else if (ce->destructor->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) { zend_error_noreturn(E_COMPILE_ERROR, "Destructor %s::%s() cannot declare a return type", - ce->name->val, ce->destructor->common.function_name->val); + ZSTR_VAL(ce->name), ZSTR_VAL(ce->destructor->common.function_name)); } } if (ce->clone) { ce->clone->common.fn_flags |= ZEND_ACC_CLONE; if (ce->clone->common.fn_flags & ZEND_ACC_STATIC) { zend_error_noreturn(E_COMPILE_ERROR, "Clone method %s::%s() cannot be static", - ce->name->val, ce->clone->common.function_name->val); + ZSTR_VAL(ce->name), ZSTR_VAL(ce->clone->common.function_name)); } else if (ce->clone->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) { zend_error_noreturn(E_COMPILE_ERROR, "%s::%s() cannot declare a return type", - ce->name->val, ce->clone->common.function_name->val); + ZSTR_VAL(ce->name), ZSTR_VAL(ce->clone->common.function_name)); } } @@ -5267,7 +5267,7 @@ static void zend_check_already_in_use(uint32_t type, zend_string *old_name, zend } zend_error_noreturn(E_COMPILE_ERROR, "Cannot use%s %s as %s because the name " - "is already in use", zend_get_use_type_str(type), old_name->val, new_name->val); + "is already in use", zend_get_use_type_str(type), ZSTR_VAL(old_name), ZSTR_VAL(new_name)); } /* }}} */ @@ -5305,7 +5305,7 @@ void zend_compile_use(zend_ast *ast) /* {{{ */ } zend_error(E_WARNING, "The use statement with non-compound name '%s' " - "has no effect", new_name->val); + "has no effect", ZSTR_VAL(new_name)); } } } @@ -5318,14 +5318,14 @@ void zend_compile_use(zend_ast *ast) /* {{{ */ if (type == T_CLASS && zend_is_reserved_class_name(new_name)) { zend_error_noreturn(E_COMPILE_ERROR, "Cannot use %s as %s because '%s' " - "is a special class name", old_name->val, new_name->val, new_name->val); + "is a special class name", ZSTR_VAL(old_name), ZSTR_VAL(new_name), ZSTR_VAL(new_name)); } if (current_ns) { - zend_string *ns_name = zend_string_alloc(current_ns->len + 1 + new_name->len, 0); - zend_str_tolower_copy(ns_name->val, current_ns->val, current_ns->len); - ns_name->val[current_ns->len] = '\\'; - memcpy(ns_name->val + current_ns->len + 1, lookup_name->val, lookup_name->len); + zend_string *ns_name = zend_string_alloc(ZSTR_LEN(current_ns) + 1 + ZSTR_LEN(new_name), 0); + zend_str_tolower_copy(ZSTR_VAL(ns_name), ZSTR_VAL(current_ns), ZSTR_LEN(current_ns)); + ZSTR_VAL(ns_name)[ZSTR_LEN(current_ns)] = '\\'; + memcpy(ZSTR_VAL(ns_name) + ZSTR_LEN(current_ns) + 1, ZSTR_VAL(lookup_name), ZSTR_LEN(lookup_name)); if (zend_hash_exists(CG(class_table), ns_name)) { zend_check_already_in_use(type, old_name, new_name, ns_name); @@ -5369,7 +5369,7 @@ void zend_compile_use(zend_ast *ast) /* {{{ */ zend_string_addref(old_name); if (!zend_hash_add_ptr(current_import, lookup_name, old_name)) { zend_error_noreturn(E_COMPILE_ERROR, "Cannot use%s %s as %s because the name " - "is already in use", zend_get_use_type_str(type), old_name->val, new_name->val); + "is already in use", zend_get_use_type_str(type), ZSTR_VAL(old_name), ZSTR_VAL(new_name)); } zend_string_release(lookup_name); @@ -5388,7 +5388,7 @@ void zend_compile_group_use(zend_ast *ast) /* {{{ */ zend_ast *inline_use, *use = list->child[i]; zval *name_zval = zend_ast_get_zval(use->child[0]); zend_string *name = Z_STR_P(name_zval); - zend_string *compound_ns = zend_concat_names(ns->val, ns->len, name->val, name->len); + zend_string *compound_ns = zend_concat_names(ZSTR_VAL(ns), ZSTR_LEN(ns), ZSTR_VAL(name), ZSTR_LEN(name)); zend_string_release(name); ZVAL_STR(name_zval, compound_ns); inline_use = zend_ast_create_list(1, ZEND_AST_USE, use); @@ -5416,8 +5416,8 @@ void zend_compile_const_decl(zend_ast *ast) /* {{{ */ value_node.op_type = IS_CONST; zend_const_expr_to_zval(value_zv, value_ast); - if (zend_lookup_reserved_const(name->val, name->len)) { - zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare constant '%s'", name->val); + if (zend_lookup_reserved_const(ZSTR_VAL(name), ZSTR_LEN(name))) { + zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare constant '%s'", ZSTR_VAL(name)); } name = zend_prefix_with_ns(name); @@ -5428,7 +5428,7 @@ void zend_compile_const_decl(zend_ast *ast) /* {{{ */ ) { if (!zend_string_equals(import_name, name)) { zend_error_noreturn(E_COMPILE_ERROR, "Cannot declare const %s because " - "the name is already in use", name->val); + "the name is already in use", ZSTR_VAL(name)); } } @@ -5492,7 +5492,7 @@ void zend_compile_namespace(zend_ast *ast) /* {{{ */ name = zend_ast_get_str(name_ast); if (ZEND_FETCH_CLASS_DEFAULT != zend_get_class_fetch_type(name)) { - zend_error_noreturn(E_COMPILE_ERROR, "Cannot use '%s' as namespace name", name->val); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot use '%s' as namespace name", ZSTR_VAL(name)); } FC(current_namespace) = zend_string_copy(name); @@ -5529,9 +5529,9 @@ void zend_compile_halt_compiler(zend_ast *ast) /* {{{ */ filename = zend_get_compiled_filename(); name = zend_mangle_property_name(const_name, sizeof(const_name) - 1, - filename->val, filename->len, 0); + ZSTR_VAL(filename), ZSTR_LEN(filename), 0); - zend_register_long_constant(name->val, name->len, offset, CONST_CS, 0); + zend_register_long_constant(ZSTR_VAL(name), ZSTR_LEN(name), offset, CONST_CS, 0); zend_string_release(name); } /* }}} */ @@ -5551,19 +5551,19 @@ static zend_bool zend_try_ct_eval_magic_const(zval *zv, zend_ast *ast) /* {{{ */ case T_DIR: { zend_string *filename = CG(compiled_filename); - zend_string *dirname = zend_string_init(filename->val, filename->len, 0); - zend_dirname(dirname->val, dirname->len); + zend_string *dirname = zend_string_init(ZSTR_VAL(filename), ZSTR_LEN(filename), 0); + zend_dirname(ZSTR_VAL(dirname), ZSTR_LEN(dirname)); - if (strcmp(dirname->val, ".") == 0) { + if (strcmp(ZSTR_VAL(dirname), ".") == 0) { dirname = zend_string_extend(dirname, MAXPATHLEN, 0); #if HAVE_GETCWD - VCWD_GETCWD(dirname->val, MAXPATHLEN); + VCWD_GETCWD(ZSTR_VAL(dirname), MAXPATHLEN); #elif HAVE_GETWD - VCWD_GETWD(dirname->val); + VCWD_GETWD(ZSTR_VAL(dirname)); #endif } - dirname->len = strlen(dirname->val); + ZSTR_LEN(dirname) = strlen(ZSTR_VAL(dirname)); ZVAL_STR(zv, dirname); break; } @@ -5577,8 +5577,8 @@ static zend_bool zend_try_ct_eval_magic_const(zval *zv, zend_ast *ast) /* {{{ */ case T_METHOD_C: if (ce) { if (op_array && op_array->function_name) { - ZVAL_NEW_STR(zv, zend_concat3(ce->name->val, ce->name->len, "::", 2, - op_array->function_name->val, op_array->function_name->len)); + ZVAL_NEW_STR(zv, zend_concat3(ZSTR_VAL(ce->name), ZSTR_LEN(ce->name), "::", 2, + ZSTR_VAL(op_array->function_name), ZSTR_LEN(op_array->function_name))); } else { ZVAL_STR_COPY(zv, ce->name); } @@ -6101,13 +6101,13 @@ static void zend_mark_function_as_generator() /* {{{ */ zend_error_noreturn(E_COMPILE_ERROR, msg, zend_get_type_by_const(CG(active_op_array)->arg_info[-1].type_hint)); } - if (!(CG(active_op_array)->arg_info[-1].class_name->len == sizeof("Traversable")-1 - && zend_binary_strcasecmp(CG(active_op_array)->arg_info[-1].class_name->val, sizeof("Traversable")-1, "Traversable", sizeof("Traversable")-1) == 0) && - !(CG(active_op_array)->arg_info[-1].class_name->len == sizeof("Iterator")-1 - && zend_binary_strcasecmp(CG(active_op_array)->arg_info[-1].class_name->val, sizeof("Iterator")-1, "Iterator", sizeof("Iterator")-1) == 0) && - !(CG(active_op_array)->arg_info[-1].class_name->len == sizeof("Generator")-1 - && zend_binary_strcasecmp(CG(active_op_array)->arg_info[-1].class_name->val, sizeof("Generator")-1, "Generator", sizeof("Generator")-1) == 0)) { - zend_error_noreturn(E_COMPILE_ERROR, msg, CG(active_op_array)->arg_info[-1].class_name->val); + if (!(ZSTR_LEN(CG(active_op_array)->arg_info[-1].class_name) == sizeof("Traversable")-1 + && zend_binary_strcasecmp(ZSTR_VAL(CG(active_op_array)->arg_info[-1].class_name), sizeof("Traversable")-1, "Traversable", sizeof("Traversable")-1) == 0) && + !(ZSTR_LEN(CG(active_op_array)->arg_info[-1].class_name) == sizeof("Iterator")-1 + && zend_binary_strcasecmp(ZSTR_VAL(CG(active_op_array)->arg_info[-1].class_name), sizeof("Iterator")-1, "Iterator", sizeof("Iterator")-1) == 0) && + !(ZSTR_LEN(CG(active_op_array)->arg_info[-1].class_name) == sizeof("Generator")-1 + && zend_binary_strcasecmp(ZSTR_VAL(CG(active_op_array)->arg_info[-1].class_name), sizeof("Generator")-1, "Generator", sizeof("Generator")-1) == 0)) { + zend_error_noreturn(E_COMPILE_ERROR, msg, ZSTR_VAL(CG(active_op_array)->arg_info[-1].class_name)); } } @@ -6717,7 +6717,7 @@ void zend_compile_const_expr_class_const(zend_ast **ast_ptr) /* {{{ */ } Z_STR(result) = zend_concat3( - class_name->val, class_name->len, "::", 2, const_name->val, const_name->len); + ZSTR_VAL(class_name), ZSTR_LEN(class_name), "::", 2, ZSTR_VAL(const_name), ZSTR_LEN(const_name)); Z_TYPE_INFO(result) = IS_CONSTANT_EX; Z_CONST_FLAGS(result) = fetch_type; diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 5da420b704..a3bc17f425 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -396,7 +396,7 @@ typedef struct _zend_internal_function { struct _zend_module_entry *module; } zend_internal_function; -#define ZEND_FN_SCOPE_NAME(function) ((function) && (function)->common.scope ? (function)->common.scope->name->val : "") +#define ZEND_FN_SCOPE_NAME(function) ((function) && (function)->common.scope ? ZSTR_VAL((function)->common.scope->name) : "") union _zend_function { zend_uchar type; /* MUST be the first element of this struct! */ diff --git a/Zend/zend_constants.c b/Zend/zend_constants.c index f8205fac0d..cde1d7aafb 100644 --- a/Zend/zend_constants.c +++ b/Zend/zend_constants.c @@ -278,14 +278,14 @@ ZEND_API zval *zend_get_constant(zend_string *name) ALLOCA_FLAG(use_heap) if ((c = zend_hash_find_ptr(EG(zend_constants), name)) == NULL) { - char *lcname = do_alloca(name->len + 1, use_heap); - zend_str_tolower_copy(lcname, name->val, name->len); - if ((c = zend_hash_str_find_ptr(EG(zend_constants), lcname, name->len)) != NULL) { + char *lcname = do_alloca(ZSTR_LEN(name) + 1, use_heap); + zend_str_tolower_copy(lcname, ZSTR_VAL(name), ZSTR_LEN(name)); + if ((c = zend_hash_str_find_ptr(EG(zend_constants), lcname, ZSTR_LEN(name))) != NULL) { if (c->flags & CONST_CS) { c = NULL; } } else { - c = zend_get_special_constant(name->val, name->len); + c = zend_get_special_constant(ZSTR_VAL(name), ZSTR_LEN(name)); } free_alloca(lcname, use_heap); } @@ -299,8 +299,8 @@ ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope, const char *colon; zend_class_entry *ce = NULL; zend_string *class_name; - const char *name = cname->val; - size_t name_len = cname->len; + const char *name = ZSTR_VAL(cname); + size_t name_len = ZSTR_LEN(cname); /* Skip leading \\ */ if (name[0] == '\\') { @@ -362,7 +362,7 @@ ZEND_API zval *zend_get_constant_ex(zend_string *cname, zend_class_entry *scope, ret_constant = zend_hash_find(&ce->constants_table, constant_name); if (ret_constant == NULL) { if ((flags & ZEND_FETCH_CLASS_SILENT) == 0) { - zend_error(E_EXCEPTION | E_ERROR, "Undefined class constant '%s::%s'", class_name->val, constant_name->val); + zend_error(E_EXCEPTION | E_ERROR, "Undefined class constant '%s::%s'", ZSTR_VAL(class_name), ZSTR_VAL(constant_name)); zend_string_release(class_name); zend_string_free(constant_name); return NULL; @@ -478,15 +478,15 @@ ZEND_API int zend_register_constant(zend_constant *c) #endif if (!(c->flags & CONST_CS)) { - lowercase_name = zend_string_alloc(c->name->len, c->flags & CONST_PERSISTENT); - zend_str_tolower_copy(lowercase_name->val, c->name->val, c->name->len); + lowercase_name = zend_string_alloc(ZSTR_LEN(c->name), c->flags & CONST_PERSISTENT); + zend_str_tolower_copy(ZSTR_VAL(lowercase_name), ZSTR_VAL(c->name), ZSTR_LEN(c->name)); lowercase_name = zend_new_interned_string(lowercase_name); name = lowercase_name; } else { - char *slash = strrchr(c->name->val, '\\'); + char *slash = strrchr(ZSTR_VAL(c->name), '\\'); if (slash) { - lowercase_name = zend_string_init(c->name->val, c->name->len, c->flags & CONST_PERSISTENT); - zend_str_tolower(lowercase_name->val, slash - c->name->val); + lowercase_name = zend_string_init(ZSTR_VAL(c->name), ZSTR_LEN(c->name), c->flags & CONST_PERSISTENT); + zend_str_tolower(ZSTR_VAL(lowercase_name), slash - ZSTR_VAL(c->name)); lowercase_name = zend_new_interned_string(lowercase_name); name = lowercase_name; } else { @@ -495,15 +495,15 @@ ZEND_API int zend_register_constant(zend_constant *c) } /* Check if the user is trying to define the internal pseudo constant name __COMPILER_HALT_OFFSET__ */ - if ((c->name->len == sizeof("__COMPILER_HALT_OFFSET__")-1 - && !memcmp(name->val, "__COMPILER_HALT_OFFSET__", sizeof("__COMPILER_HALT_OFFSET__")-1)) + if ((ZSTR_LEN(c->name) == sizeof("__COMPILER_HALT_OFFSET__")-1 + && !memcmp(ZSTR_VAL(name), "__COMPILER_HALT_OFFSET__", sizeof("__COMPILER_HALT_OFFSET__")-1)) || zend_hash_add_constant(EG(zend_constants), name, c) == NULL) { /* The internal __COMPILER_HALT_OFFSET__ is prefixed by NULL byte */ - if (c->name->val[0] == '\0' && c->name->len > sizeof("\0__COMPILER_HALT_OFFSET__")-1 - && memcmp(name->val, "\0__COMPILER_HALT_OFFSET__", sizeof("\0__COMPILER_HALT_OFFSET__")) == 0) { + if (ZSTR_VAL(c->name)[0] == '\0' && ZSTR_LEN(c->name) > sizeof("\0__COMPILER_HALT_OFFSET__")-1 + && memcmp(ZSTR_VAL(name), "\0__COMPILER_HALT_OFFSET__", sizeof("\0__COMPILER_HALT_OFFSET__")) == 0) { } - zend_error(E_NOTICE,"Constant %s already defined", name->val); + zend_error(E_NOTICE,"Constant %s already defined", ZSTR_VAL(name)); zend_string_release(c->name); if (!(c->flags & CONST_PERSISTENT)) { zval_dtor(&c->value); diff --git a/Zend/zend_dtrace.c b/Zend/zend_dtrace.c index a4682477c3..613596dc38 100644 --- a/Zend/zend_dtrace.c +++ b/Zend/zend_dtrace.c @@ -32,7 +32,7 @@ static inline const char *dtrace_get_executed_filename(void) ex = ex->prev_execute_data; } if (ex) { - return ex->func->op_array.filename->val; + return ZSTR_VAL(ex->func->op_array.filename); } else { return zend_get_executed_filename(); } diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index 43ad600a68..b0547b07a9 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -47,10 +47,10 @@ static int zend_implement_throwable(zend_class_entry *interface, zend_class_entr return SUCCESS; } zend_error_noreturn(E_ERROR, "Class %s cannot implement interface %s, extend %s or %s instead", - class_type->name->val, - interface->name->val, - default_exception_ce->name->val, - error_ce->name->val); + ZSTR_VAL(class_type->name), + ZSTR_VAL(interface->name), + ZSTR_VAL(default_exception_ce->name), + ZSTR_VAL(error_ce->name)); return FAILURE; } /* }}} */ @@ -122,7 +122,7 @@ ZEND_API void zend_throw_exception_internal(zval *exception) /* {{{ */ #ifdef HAVE_DTRACE if (DTRACE_EXCEPTION_THROWN_ENABLED()) { if (exception != NULL) { - DTRACE_EXCEPTION_THROWN(Z_OBJ_P(exception)->ce->name->val); + DTRACE_EXCEPTION_THROWN(ZSTR_VAL(Z_OBJ_P(exception)->ce->name)); } else { DTRACE_EXCEPTION_THROWN(NULL); } @@ -207,7 +207,7 @@ static zend_object *zend_default_exception_new_ex(zend_class_entry *class_type, zend_update_property_string(base_ce, &obj, "file", sizeof("file")-1, zend_get_executed_filename()); zend_update_property_long(base_ce, &obj, "line", sizeof("line")-1, zend_get_executed_lineno()); } else { - zend_update_property_string(base_ce, &obj, "file", sizeof("file")-1, filename->val); + zend_update_property_string(base_ce, &obj, "file", sizeof("file")-1, ZSTR_VAL(filename)); zend_update_property_long(base_ce, &obj, "line", sizeof("line")-1, zend_get_compiled_lineno()); } zend_update_property(base_ce, &obj, "trace", sizeof("trace")-1, &trace); @@ -258,7 +258,7 @@ ZEND_METHOD(exception, __construct) } else { ce = base_ce; } - zend_error(E_EXCEPTION | E_ERROR, "Wrong parameters for %s([string $message [, long $code [, Throwable $previous = NULL]]])", ce->name->val); + zend_error(E_EXCEPTION | E_ERROR, "Wrong parameters for %s([string $message [, long $code [, Throwable $previous = NULL]]])", ZSTR_VAL(ce->name)); return; } @@ -294,7 +294,7 @@ ZEND_METHOD(error_exception, __construct) } else { ce = error_exception_ce; } - zend_error(E_EXCEPTION | E_ERROR, "Wrong parameters for %s([string $message [, long $code, [ long $severity, [ string $filename, [ long $lineno [, Throwable $previous = NULL]]]]]])", ce->name->val); + zend_error(E_EXCEPTION | E_ERROR, "Wrong parameters for %s([string $message [, long $code, [ long $severity, [ string $filename, [ long $lineno [, Throwable $previous = NULL]]]]]])", ZSTR_VAL(ce->name)); return; } @@ -442,8 +442,8 @@ static void smart_str_append_escaped(smart_str *str, const char *s, size_t l) { size_t i, len = compute_escaped_string_len(s, l); smart_str_alloc(str, len, 0); - res = &str->s->val[str->s->len]; - str->s->len += len; + res = &ZSTR_VAL(str->s)[ZSTR_LEN(str->s)]; + ZSTR_LEN(str->s) += len; for (i = 0; i < l; ++i) { unsigned char c = s[i]; @@ -575,15 +575,15 @@ static void _build_trace_string(smart_str *str, HashTable *ht, uint32_t num) /* tmp = zend_hash_str_find(ht, "args", sizeof("args")-1); if (tmp) { if (Z_TYPE_P(tmp) == IS_ARRAY) { - size_t last_len = str->s->len; + size_t last_len = ZSTR_LEN(str->s); zval *arg; ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(tmp), arg) { _build_trace_args(arg, str); } ZEND_HASH_FOREACH_END(); - if (last_len != str->s->len) { - str->s->len -= 2; /* remove last ', ' */ + if (last_len != ZSTR_LEN(str->s)) { + ZSTR_LEN(str->s) -= 2; /* remove last ', ' */ } } else { zend_error(E_WARNING, "args element is no array"); @@ -706,24 +706,24 @@ ZEND_METHOD(exception, __toString) ZVAL_UNDEF(&trace); } - if (Z_OBJCE_P(exception) == type_error_ce && strstr(message->val, ", called in ")) { - zend_string *real_message = zend_strpprintf(0, "%s and defined", message->val); + if (Z_OBJCE_P(exception) == type_error_ce && strstr(ZSTR_VAL(message), ", called in ")) { + zend_string *real_message = zend_strpprintf(0, "%s and defined", ZSTR_VAL(message)); zend_string_release(message); message = real_message; } - if (message->len > 0) { + if (ZSTR_LEN(message) > 0) { str = zend_strpprintf(0, "%s: %s in %s:" ZEND_LONG_FMT "\nStack trace:\n%s%s%s", - Z_OBJCE_P(exception)->name->val, message->val, file->val, line, + ZSTR_VAL(Z_OBJCE_P(exception)->name), ZSTR_VAL(message), ZSTR_VAL(file), line, (Z_TYPE(trace) == IS_STRING && Z_STRLEN(trace)) ? Z_STRVAL(trace) : "#0 {main}\n", - prev_str->len ? "\n\nNext " : "", prev_str->val); + ZSTR_LEN(prev_str) ? "\n\nNext " : "", ZSTR_VAL(prev_str)); } else { str = zend_strpprintf(0, "%s in %s:" ZEND_LONG_FMT "\nStack trace:\n%s%s%s", - Z_OBJCE_P(exception)->name->val, file->val, line, + ZSTR_VAL(Z_OBJCE_P(exception)->name), ZSTR_VAL(file), line, (Z_TYPE(trace) == IS_STRING && Z_STRLEN(trace)) ? Z_STRVAL(trace) : "#0 {main}\n", - prev_str->len ? "\n\nNext " : "", prev_str->val); + ZSTR_LEN(prev_str) ? "\n\nNext " : "", ZSTR_VAL(prev_str)); } zend_string_release(prev_str); @@ -973,7 +973,7 @@ ZEND_API void zend_exception_error(zend_object *ex, int severity) /* {{{ */ zend_long line = zval_get_long(GET_PROPERTY_SILENT(&exception, "line")); zend_long code = zval_get_long(GET_PROPERTY_SILENT(&exception, "code")); - zend_error_helper(code? code : E_ERROR, file->val, line, "%s", message->val); + zend_error_helper(code? code : E_ERROR, ZSTR_VAL(file), line, "%s", ZSTR_VAL(message)); zend_string_release(file); zend_string_release(message); @@ -985,9 +985,9 @@ ZEND_API void zend_exception_error(zend_object *ex, int severity) /* {{{ */ zend_call_method_with_0_params(&exception, ce_exception, NULL, "__tostring", &tmp); if (!EG(exception)) { if (Z_TYPE(tmp) != IS_STRING) { - zend_error(E_WARNING, "%s::__toString() must return a string", ce_exception->name->val); + zend_error(E_WARNING, "%s::__toString() must return a string", ZSTR_VAL(ce_exception->name)); } else { - zend_update_property_string(i_get_exception_base(&exception), &exception, "string", sizeof("string")-1, EG(exception) ? ce_exception->name->val : Z_STRVAL(tmp)); + zend_update_property_string(i_get_exception_base(&exception), &exception, "string", sizeof("string")-1, EG(exception) ? ZSTR_VAL(ce_exception->name) : Z_STRVAL(tmp)); } } zval_ptr_dtor(&tmp); @@ -1002,9 +1002,9 @@ ZEND_API void zend_exception_error(zend_object *ex, int severity) /* {{{ */ line = zval_get_long(GET_PROPERTY_SILENT(&zv, "line")); } - zend_error_va(E_WARNING, (file && file->len > 0) ? file->val : NULL, line, + zend_error_va(E_WARNING, (file && ZSTR_LEN(file) > 0) ? ZSTR_VAL(file) : NULL, line, "Uncaught %s in exception handling during call to %s::__tostring()", - Z_OBJCE(zv)->name->val, ce_exception->name->val); + ZSTR_VAL(Z_OBJCE(zv)->name), ZSTR_VAL(ce_exception->name)); if (file) { zend_string_release(file); @@ -1015,13 +1015,13 @@ ZEND_API void zend_exception_error(zend_object *ex, int severity) /* {{{ */ file = zval_get_string(GET_PROPERTY_SILENT(&exception, "file")); line = zval_get_long(GET_PROPERTY_SILENT(&exception, "line")); - zend_error_va(severity, (file && file->len > 0) ? file->val : NULL, line, - "Uncaught %s\n thrown", str->val); + zend_error_va(severity, (file && ZSTR_LEN(file) > 0) ? ZSTR_VAL(file) : NULL, line, + "Uncaught %s\n thrown", ZSTR_VAL(str)); zend_string_release(str); zend_string_release(file); } else { - zend_error(severity, "Uncaught exception '%s'", ce_exception->name->val); + zend_error(severity, "Uncaught exception '%s'", ZSTR_VAL(ce_exception->name)); } OBJ_RELEASE(ex); diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 79f3c8c20a..4c60eb5ae1 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -229,14 +229,14 @@ static zend_never_inline zval *_get_zval_cv_lookup(zval *ptr, uint32_t var, int case BP_VAR_R: case BP_VAR_UNSET: cv = CV_DEF_OF(EX_VAR_TO_NUM(var)); - zend_error(E_NOTICE, "Undefined variable: %s", cv->val); + zend_error(E_NOTICE, "Undefined variable: %s", ZSTR_VAL(cv)); /* break missing intentionally */ case BP_VAR_IS: ptr = &EG(uninitialized_zval); break; case BP_VAR_RW: cv = CV_DEF_OF(EX_VAR_TO_NUM(var)); - zend_error(E_NOTICE, "Undefined variable: %s", cv->val); + zend_error(E_NOTICE, "Undefined variable: %s", ZSTR_VAL(cv)); /* break missing intentionally */ case BP_VAR_W: ZVAL_NULL(ptr); @@ -249,7 +249,7 @@ static zend_always_inline zval *_get_zval_cv_lookup_BP_VAR_R(zval *ptr, uint32_t { zend_string *cv = CV_DEF_OF(EX_VAR_TO_NUM(var)); - zend_error(E_NOTICE, "Undefined variable: %s", cv->val); + zend_error(E_NOTICE, "Undefined variable: %s", ZSTR_VAL(cv)); return &EG(uninitialized_zval); } @@ -257,7 +257,7 @@ static zend_always_inline zval *_get_zval_cv_lookup_BP_VAR_UNSET(zval *ptr, uint { zend_string *cv = CV_DEF_OF(EX_VAR_TO_NUM(var)); - zend_error(E_NOTICE, "Undefined variable: %s", cv->val); + zend_error(E_NOTICE, "Undefined variable: %s", ZSTR_VAL(cv)); return &EG(uninitialized_zval); } @@ -266,7 +266,7 @@ static zend_always_inline zval *_get_zval_cv_lookup_BP_VAR_RW(zval *ptr, uint32_ zend_string *cv = CV_DEF_OF(EX_VAR_TO_NUM(var)); ZVAL_NULL(ptr); - zend_error(E_NOTICE, "Undefined variable: %s", cv->val); + zend_error(E_NOTICE, "Undefined variable: %s", ZSTR_VAL(cv)); return ptr; } @@ -577,7 +577,7 @@ ZEND_API char * zend_verify_internal_arg_class_kind(const zend_internal_arg_info *pce = zend_fetch_class(key, (ZEND_FETCH_CLASS_AUTO | ZEND_FETCH_CLASS_NO_AUTOLOAD)); ZSTR_ALLOCA_FREE(key, use_heap); - *class_name = (*pce) ? (*pce)->name->val : (char*)cur_arg_info->class_name; + *class_name = (*pce) ? ZSTR_VAL((*pce)->name) : (char*)cur_arg_info->class_name; if (*pce && (*pce)->ce_flags & ZEND_ACC_INTERFACE) { return "implement interface "; } else { @@ -593,13 +593,13 @@ static zend_always_inline zend_class_entry* zend_verify_arg_class_kind(const zen ZEND_API void zend_verify_arg_error(const zend_function *zf, uint32_t arg_num, const char *need_msg, const char *need_kind, const char *given_msg, const char *given_kind, zval *arg) { zend_execute_data *ptr = EG(current_execute_data)->prev_execute_data; - const char *fname = zf->common.function_name->val; + const char *fname = ZSTR_VAL(zf->common.function_name); const char *fsep; const char *fclass; if (zf->common.scope) { fsep = "::"; - fclass = zf->common.scope->name->val; + fclass = ZSTR_VAL(zf->common.scope->name); } else { fsep = ""; fclass = ""; @@ -609,7 +609,7 @@ ZEND_API void zend_verify_arg_error(const zend_function *zf, uint32_t arg_num, c if (ptr && ptr->func && ZEND_USER_CODE(ptr->func->common.type)) { zend_type_error("Argument %d passed to %s%s%s() must %s%s, %s%s given, called in %s on line %d", arg_num, fclass, fsep, fname, need_msg, need_kind, given_msg, given_kind, - ptr->func->op_array.filename->val, ptr->opline->lineno); + ZSTR_VAL(ptr->func->op_array.filename), ptr->opline->lineno); } else { zend_type_error("Argument %d passed to %s%s%s() must %s%s, %s%s given", arg_num, fclass, fsep, fname, need_msg, need_kind, given_msg, given_kind); } @@ -716,7 +716,7 @@ static void zend_verify_internal_arg_type(zend_function *zf, uint32_t arg_num, z if (cur_arg_info->class_name) { need_msg = zend_verify_internal_arg_class_kind((zend_internal_arg_info*)cur_arg_info, &class_name, &ce); if (!ce || !instanceof_function(Z_OBJCE_P(arg), ce)) { - zend_verify_arg_error(zf, arg_num, need_msg, class_name, "instance of ", Z_OBJCE_P(arg)->name->val, arg); + zend_verify_arg_error(zf, arg_num, need_msg, class_name, "instance of ", ZSTR_VAL(Z_OBJCE_P(arg)->name), arg); } } } else if (Z_TYPE_P(arg) != IS_NULL || !cur_arg_info->allow_null) { @@ -760,7 +760,7 @@ static zend_always_inline int zend_verify_arg_type(zend_function *zf, uint32_t a } else { ce = zend_verify_arg_class_kind(cur_arg_info); if (UNEXPECTED(!ce)) { - zend_verify_arg_error(zf, arg_num, "be an instance of ", cur_arg_info->class_name->val, "instance of ", Z_OBJCE_P(arg)->name->val, arg); + zend_verify_arg_error(zf, arg_num, "be an instance of ", ZSTR_VAL(cur_arg_info->class_name), "instance of ", ZSTR_VAL(Z_OBJCE_P(arg)->name), arg); return 0; } *cache_slot = (void*)ce; @@ -769,7 +769,7 @@ static zend_always_inline int zend_verify_arg_type(zend_function *zf, uint32_t a need_msg = (ce->ce_flags & ZEND_ACC_INTERFACE) ? "implement interface " : "be an instance of "; - zend_verify_arg_error(zf, arg_num, need_msg, ce->name->val, "instance of ", Z_OBJCE_P(arg)->name->val, arg); + zend_verify_arg_error(zf, arg_num, need_msg, ZSTR_VAL(ce->name), "instance of ", ZSTR_VAL(Z_OBJCE_P(arg)->name), arg); return 0; } } @@ -781,9 +781,9 @@ static zend_always_inline int zend_verify_arg_type(zend_function *zf, uint32_t a ce = zend_verify_arg_class_kind(cur_arg_info); if (UNEXPECTED(!ce)) { if (Z_TYPE_P(arg) == IS_OBJECT) { - zend_verify_arg_error(zf, arg_num, "be an instance of ", cur_arg_info->class_name->val, "instance of ", Z_OBJCE_P(arg)->name->val, arg); + zend_verify_arg_error(zf, arg_num, "be an instance of ", ZSTR_VAL(cur_arg_info->class_name), "instance of ", ZSTR_VAL(Z_OBJCE_P(arg)->name), arg); } else { - zend_verify_arg_error(zf, arg_num, "be an instance of ", cur_arg_info->class_name->val, "", zend_zval_type_name(arg), arg); + zend_verify_arg_error(zf, arg_num, "be an instance of ", ZSTR_VAL(cur_arg_info->class_name), "", zend_zval_type_name(arg), arg); } return 0; } @@ -792,7 +792,7 @@ static zend_always_inline int zend_verify_arg_type(zend_function *zf, uint32_t a need_msg = (ce->ce_flags & ZEND_ACC_INTERFACE) ? "implement interface " : "be an instance of "; - zend_verify_arg_error(zf, arg_num, need_msg, ce->name->val, zend_zval_type_name(arg), "", arg); + zend_verify_arg_error(zf, arg_num, need_msg, ZSTR_VAL(ce->name), zend_zval_type_name(arg), "", arg); return 0; } else if (cur_arg_info->type_hint == IS_CALLABLE) { if (!zend_is_callable(arg, IS_CALLABLE_CHECK_SILENT, NULL)) { @@ -832,7 +832,7 @@ static zend_always_inline int zend_verify_missing_arg_type(zend_function *zf, ui } else { ce = zend_verify_arg_class_kind(cur_arg_info); if (UNEXPECTED(!ce)) { - zend_verify_arg_error(zf, arg_num, "be an instance of ", cur_arg_info->class_name->val, "none", "", NULL); + zend_verify_arg_error(zf, arg_num, "be an instance of ", ZSTR_VAL(cur_arg_info->class_name), "none", "", NULL); return 0; } *cache_slot = (void*)ce; @@ -840,7 +840,7 @@ static zend_always_inline int zend_verify_missing_arg_type(zend_function *zf, ui need_msg = (ce->ce_flags & ZEND_ACC_INTERFACE) ? "implement interface " : "be an instance of "; - zend_verify_arg_error(zf, arg_num, need_msg, ce->name->val, "none", "", NULL); + zend_verify_arg_error(zf, arg_num, need_msg, ZSTR_VAL(ce->name), "none", "", NULL); } else if (cur_arg_info->type_hint == IS_CALLABLE) { zend_verify_arg_error(zf, arg_num, "be callable", "", "none", "", NULL); } else { @@ -855,13 +855,13 @@ static zend_always_inline int zend_verify_missing_arg(zend_execute_data *execute { if (EXPECTED(!(EX(func)->common.fn_flags & ZEND_ACC_HAS_TYPE_HINTS)) || zend_verify_missing_arg_type(EX(func), arg_num, cache_slot)) { - const char *class_name = EX(func)->common.scope ? EX(func)->common.scope->name->val : ""; + const char *class_name = EX(func)->common.scope ? ZSTR_VAL(EX(func)->common.scope->name) : ""; const char *space = EX(func)->common.scope ? "::" : ""; - const char *func_name = EX(func)->common.function_name ? EX(func)->common.function_name->val : "main"; + const char *func_name = EX(func)->common.function_name ? ZSTR_VAL(EX(func)->common.function_name) : "main"; zend_execute_data *ptr = EX(prev_execute_data); if (ptr && ptr->func && ZEND_USER_CODE(ptr->func->common.type)) { - zend_error(E_WARNING, "Missing argument %u for %s%s%s(), called in %s on line %d and defined", arg_num, class_name, space, func_name, ptr->func->op_array.filename->val, ptr->opline->lineno); + zend_error(E_WARNING, "Missing argument %u for %s%s%s(), called in %s on line %d and defined", arg_num, class_name, space, func_name, ZSTR_VAL(ptr->func->op_array.filename), ptr->opline->lineno); } else { zend_error(E_WARNING, "Missing argument %u for %s%s%s()", arg_num, class_name, space, func_name); } @@ -872,13 +872,13 @@ static zend_always_inline int zend_verify_missing_arg(zend_execute_data *execute ZEND_API void zend_verify_return_error(const zend_function *zf, const char *need_msg, const char *need_kind, const char *returned_msg, const char *returned_kind) { - const char *fname = zf->common.function_name->val; + const char *fname = ZSTR_VAL(zf->common.function_name); const char *fsep; const char *fclass; if (zf->common.scope) { fsep = "::"; - fclass = zf->common.scope->name->val; + fclass = ZSTR_VAL(zf->common.scope->name); } else { fsep = ""; fclass = ""; @@ -887,7 +887,7 @@ ZEND_API void zend_verify_return_error(const zend_function *zf, const char *need if (zf->common.type == ZEND_USER_FUNCTION) { zend_type_error("Return value of %s%s%s() must %s%s, %s%s returned in %s on line %d", fclass, fsep, fname, need_msg, need_kind, returned_msg, returned_kind, - zf->op_array.filename->val, EG(current_execute_data)->opline->lineno); + ZSTR_VAL(zf->op_array.filename), EG(current_execute_data)->opline->lineno); } else { zend_type_error("Return value of %s%s%s() must %s%s, %s%s returned", fclass, fsep, fname, need_msg, need_kind, returned_msg, returned_kind); @@ -896,13 +896,13 @@ ZEND_API void zend_verify_return_error(const zend_function *zf, const char *need ZEND_API void zend_verify_internal_return_error(const zend_function *zf, const char *need_msg, const char *need_kind, const char *returned_msg, const char *returned_kind) { - const char *fname = zf->common.function_name->val; + const char *fname = ZSTR_VAL(zf->common.function_name); const char *fsep; const char *fclass; if (zf->common.scope) { fsep = "::"; - fclass = zf->common.scope->name->val; + fclass = ZSTR_VAL(zf->common.scope->name); } else { fsep = ""; fclass = ""; @@ -925,7 +925,7 @@ static int zend_verify_internal_return_type(zend_function *zf, zval *ret) if (ret_info->class_name) { need_msg = zend_verify_internal_arg_class_kind((zend_internal_arg_info *)ret_info, &class_name, &ce); if (!ce || !instanceof_function(Z_OBJCE_P(ret), ce)) { - zend_verify_internal_return_error(zf, need_msg, class_name, "instance of ", Z_OBJCE_P(ret)->name->val); + zend_verify_internal_return_error(zf, need_msg, class_name, "instance of ", ZSTR_VAL(Z_OBJCE_P(ret)->name)); return 0; } } @@ -966,7 +966,7 @@ static zend_always_inline void zend_verify_return_type(zend_function *zf, zval * } else { ce = zend_verify_arg_class_kind(ret_info); if (UNEXPECTED(!ce)) { - zend_verify_return_error(zf, "be an instance of ", ret_info->class_name->val, "instance of ", Z_OBJCE_P(ret)->name->val); + zend_verify_return_error(zf, "be an instance of ", ZSTR_VAL(ret_info->class_name), "instance of ", ZSTR_VAL(Z_OBJCE_P(ret)->name)); return; } *cache_slot = (void*)ce; @@ -975,7 +975,7 @@ static zend_always_inline void zend_verify_return_type(zend_function *zf, zval * need_msg = (ce->ce_flags & ZEND_ACC_INTERFACE) ? "implement interface " : "be an instance of "; - zend_verify_return_error(zf, need_msg, ce->name->val, "instance of ", Z_OBJCE_P(ret)->name->val); + zend_verify_return_error(zf, need_msg, ZSTR_VAL(ce->name), "instance of ", ZSTR_VAL(Z_OBJCE_P(ret)->name)); } } } else if (Z_TYPE_P(ret) != IS_NULL || !ret_info->allow_null) { @@ -985,7 +985,7 @@ static zend_always_inline void zend_verify_return_type(zend_function *zf, zval * } else { ce = zend_verify_arg_class_kind(ret_info); if (UNEXPECTED(!ce)) { - zend_verify_return_error(zf, "be an instance of ", ret_info->class_name->val, zend_zval_type_name(ret), ""); + zend_verify_return_error(zf, "be an instance of ", ZSTR_VAL(ret_info->class_name), zend_zval_type_name(ret), ""); return; } *cache_slot = (void*)ce; @@ -993,7 +993,7 @@ static zend_always_inline void zend_verify_return_type(zend_function *zf, zval * need_msg = (ce->ce_flags & ZEND_ACC_INTERFACE) ? "implement interface " : "be an instance of "; - zend_verify_return_error(zf, need_msg, ce->name->val, zend_zval_type_name(ret), ""); + zend_verify_return_error(zf, need_msg, ZSTR_VAL(ce->name), zend_zval_type_name(ret), ""); } else if (ret_info->type_hint == IS_CALLABLE) { if (!zend_is_callable(ret, IS_CALLABLE_CHECK_SILENT, NULL)) { zend_verify_return_error(zf, "be callable", "", zend_zval_type_name(ret), ""); @@ -1021,7 +1021,7 @@ static zend_always_inline int zend_verify_missing_return_type(zend_function *zf, } else { ce = zend_verify_arg_class_kind(ret_info); if (UNEXPECTED(!ce)) { - zend_verify_return_error(zf, "be an instance of ", ret_info->class_name->val, "none", ""); + zend_verify_return_error(zf, "be an instance of ", ZSTR_VAL(ret_info->class_name), "none", ""); return 0; } *cache_slot = (void*)ce; @@ -1029,7 +1029,7 @@ static zend_always_inline int zend_verify_missing_return_type(zend_function *zf, need_msg = (ce->ce_flags & ZEND_ACC_INTERFACE) ? "implement interface " : "be an instance of "; - zend_verify_return_error(zf, need_msg, ce->name->val, "none", ""); + zend_verify_return_error(zf, need_msg, ZSTR_VAL(ce->name), "none", ""); return 0; } else if (ret_info->type_hint == IS_CALLABLE) { zend_verify_return_error(zf, "be callable", "", "none", ""); @@ -1289,7 +1289,7 @@ static void zend_assign_to_string_offset(zval *str, zend_long offset, zval *valu if (Z_TYPE_P(value) != IS_STRING) { zend_string *tmp = zval_get_string(value); - Z_STRVAL_P(str)[offset] = tmp->val[0]; + Z_STRVAL_P(str)[offset] = ZSTR_VAL(tmp)[0]; zend_string_release(tmp); } else { Z_STRVAL_P(str)[offset] = Z_STRVAL_P(value)[0]; @@ -1533,14 +1533,14 @@ str_index: if (UNEXPECTED(Z_TYPE_P(retval) == IS_UNDEF)) { switch (type) { case BP_VAR_R: - zend_error(E_NOTICE, "Undefined index: %s", offset_key->val); + zend_error(E_NOTICE, "Undefined index: %s", ZSTR_VAL(offset_key)); /* break missing intentionally */ case BP_VAR_UNSET: case BP_VAR_IS: retval = &EG(uninitialized_zval); break; case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined index: %s", offset_key->val); + zend_error(E_NOTICE,"Undefined index: %s", ZSTR_VAL(offset_key)); /* break missing intentionally */ case BP_VAR_W: ZVAL_NULL(retval); @@ -1551,14 +1551,14 @@ str_index: } else { switch (type) { case BP_VAR_R: - zend_error(E_NOTICE, "Undefined index: %s", offset_key->val); + zend_error(E_NOTICE, "Undefined index: %s", ZSTR_VAL(offset_key)); /* break missing intentionally */ case BP_VAR_UNSET: case BP_VAR_IS: retval = &EG(uninitialized_zval); break; case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined index: %s", offset_key->val); + zend_error(E_NOTICE,"Undefined index: %s", ZSTR_VAL(offset_key)); /* break missing intentionally */ case BP_VAR_W: retval = zend_hash_add_new(ht, offset_key, &EG(uninitialized_zval)); @@ -1698,7 +1698,7 @@ convert_to_array: zend_class_entry *ce = Z_OBJCE_P(container); ZVAL_NULL(result); - zend_error(E_NOTICE, "Indirect modification of overloaded element of %s has no effect", ce->name->val); + zend_error(E_NOTICE, "Indirect modification of overloaded element of %s has no effect", ZSTR_VAL(ce->name)); } else if (EXPECTED(retval && Z_TYPE_P(retval) != IS_UNDEF)) { if (!Z_ISREF_P(retval)) { if (Z_REFCOUNTED_P(retval) && @@ -1714,7 +1714,7 @@ convert_to_array: } if (Z_TYPE_P(retval) != IS_OBJECT) { zend_class_entry *ce = Z_OBJCE_P(container); - zend_error(E_NOTICE, "Indirect modification of overloaded element of %s has no effect", ce->name->val); + zend_error(E_NOTICE, "Indirect modification of overloaded element of %s has no effect", ZSTR_VAL(ce->name)); } } if (result != retval) { diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index a7ab662c99..bd432deaa4 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -412,7 +412,7 @@ ZEND_API const char *get_active_class_name(const char **space) /* {{{ */ if (space) { *space = ce ? "::" : ""; } - return ce ? ce->name->val : ""; + return ce ? ZSTR_VAL(ce->name) : ""; } default: if (space) { @@ -436,14 +436,14 @@ ZEND_API const char *get_active_function_name(void) /* {{{ */ zend_string *function_name = func->common.function_name; if (function_name) { - return function_name->val; + return ZSTR_VAL(function_name); } else { return "main"; } } break; case ZEND_INTERNAL_FUNCTION: - return func->common.function_name->val; + return ZSTR_VAL(func->common.function_name); break; default: return NULL; @@ -459,7 +459,7 @@ ZEND_API const char *zend_get_executed_filename(void) /* {{{ */ ex = ex->prev_execute_data; } if (ex) { - return ex->func->op_array.filename->val; + return ZSTR_VAL(ex->func->op_array.filename); } else { return "[no active file]"; } @@ -585,10 +585,10 @@ ZEND_API int zval_update_constant_ex(zval *p, zend_bool inline_change, zend_clas --actual_len; } if ((Z_CONST_FLAGS_P(p) & IS_CONSTANT_UNQUALIFIED) == 0) { - if (save->val[0] == '\\') { - zend_error(E_EXCEPTION | E_ERROR, "Undefined constant '%s'", save->val + 1); + if (ZSTR_VAL(save)[0] == '\\') { + zend_error(E_EXCEPTION | E_ERROR, "Undefined constant '%s'", ZSTR_VAL(save) + 1); } else { - zend_error(E_EXCEPTION | E_ERROR, "Undefined constant '%s'", save->val); + zend_error(E_EXCEPTION | E_ERROR, "Undefined constant '%s'", ZSTR_VAL(save)); } if (inline_change) { zend_string_release(save); @@ -602,7 +602,7 @@ ZEND_API int zval_update_constant_ex(zval *p, zend_bool inline_change, zend_clas } else { Z_TYPE_INFO_P(p) = Z_REFCOUNTED_P(p) ? IS_STRING_EX : IS_INTERNED_STRING_EX; - if (save && save->val != actual) { + if (save && ZSTR_VAL(save) != actual) { zend_string_release(save); } } @@ -730,7 +730,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) / if (!zend_is_callable_ex(&fci->function_name, fci->object, IS_CALLABLE_CHECK_SILENT, &callable_name, fci_cache, &error)) { if (error) { - zend_error(E_WARNING, "Invalid callback %s, %s", callable_name->val, error); + zend_error(E_WARNING, "Invalid callback %s, %s", ZSTR_VAL(callable_name), error); efree(error); } if (callable_name) { @@ -767,14 +767,14 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) / if (func->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED)) { if (func->common.fn_flags & ZEND_ACC_ABSTRACT) { - zend_error(E_EXCEPTION | E_ERROR, "Cannot call abstract method %s::%s()", func->common.scope->name->val, func->common.function_name->val); + zend_error(E_EXCEPTION | E_ERROR, "Cannot call abstract method %s::%s()", ZSTR_VAL(func->common.scope->name), ZSTR_VAL(func->common.function_name)); return FAILURE; } if (func->common.fn_flags & ZEND_ACC_DEPRECATED) { zend_error(E_DEPRECATED, "Function %s%s%s() is deprecated", - func->common.scope ? func->common.scope->name->val : "", + func->common.scope ? ZSTR_VAL(func->common.scope->name) : "", func->common.scope ? "::" : "", - func->common.function_name->val); + ZSTR_VAL(func->common.function_name)); } } @@ -795,9 +795,9 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) / zend_error(E_WARNING, "Parameter %d to %s%s%s() expected to be a reference, value given", i+1, - func->common.scope ? func->common.scope->name->val : "", + func->common.scope ? ZSTR_VAL(func->common.scope->name) : "", func->common.scope ? "::" : "", - func->common.function_name->val); + ZSTR_VAL(func->common.function_name)); if (EG(current_execute_data) == &dummy_execute_data) { EG(current_execute_data) = dummy_execute_data.prev_execute_data; } @@ -932,13 +932,13 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, const zval *k if (key) { lc_name = Z_STR_P(key); } else { - if (name == NULL || !name->len) { + if (name == NULL || !ZSTR_LEN(name)) { return NULL; } - if (name->val[0] == '\\') { - lc_name = zend_string_alloc(name->len - 1, 0); - zend_str_tolower_copy(lc_name->val, name->val + 1, name->len - 1); + if (ZSTR_VAL(name)[0] == '\\') { + lc_name = zend_string_alloc(ZSTR_LEN(name) - 1, 0); + zend_str_tolower_copy(ZSTR_VAL(lc_name), ZSTR_VAL(name) + 1, ZSTR_LEN(name) - 1); } else { lc_name = zend_string_tolower(name); } @@ -976,7 +976,7 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, const zval *k } /* Verify class name before passing it to __autoload() */ - if (strspn(name->val, "0123456789_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377\\") != name->len) { + if (strspn(ZSTR_VAL(name), "0123456789_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377\\") != ZSTR_LEN(name)) { if (!key) { zend_string_release(lc_name); } @@ -997,8 +997,8 @@ ZEND_API zend_class_entry *zend_lookup_class_ex(zend_string *name, const zval *k ZVAL_UNDEF(&local_retval); - if (name->val[0] == '\\') { - ZVAL_STRINGL(&args[0], name->val + 1, name->len - 1); + if (ZSTR_VAL(name)[0] == '\\') { + ZVAL_STRINGL(&args[0], ZSTR_VAL(name) + 1, ZSTR_LEN(name) - 1); } else { ZVAL_STR_COPY(&args[0], name); } @@ -1358,11 +1358,11 @@ check_fetch_type: int error_type = (fetch_type & ZEND_FETCH_CLASS_EXCEPTION) ? (E_EXCEPTION | E_ERROR) : E_ERROR; if (fetch_sub_type == ZEND_FETCH_CLASS_INTERFACE) { - zend_error(error_type, "Interface '%s' not found", class_name->val); + zend_error(error_type, "Interface '%s' not found", ZSTR_VAL(class_name)); } else if (fetch_sub_type == ZEND_FETCH_CLASS_TRAIT) { - zend_error(error_type, "Trait '%s' not found", class_name->val); + zend_error(error_type, "Trait '%s' not found", ZSTR_VAL(class_name)); } else { - zend_error(error_type, "Class '%s' not found", class_name->val); + zend_error(error_type, "Class '%s' not found", ZSTR_VAL(class_name)); } } return NULL; @@ -1382,11 +1382,11 @@ zend_class_entry *zend_fetch_class_by_name(zend_string *class_name, const zval * int error_type = (fetch_type & ZEND_FETCH_CLASS_EXCEPTION) ? (E_EXCEPTION | E_ERROR) : E_ERROR; if ((fetch_type & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_INTERFACE) { - zend_error(error_type, "Interface '%s' not found", class_name->val); + zend_error(error_type, "Interface '%s' not found", ZSTR_VAL(class_name)); } else if ((fetch_type & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_TRAIT) { - zend_error(error_type, "Trait '%s' not found", class_name->val); + zend_error(error_type, "Trait '%s' not found", ZSTR_VAL(class_name)); } else { - zend_error(error_type, "Class '%s' not found", class_name->val); + zend_error(error_type, "Class '%s' not found", ZSTR_VAL(class_name)); } } return NULL; @@ -1400,7 +1400,7 @@ zend_class_entry *zend_fetch_class_by_name(zend_string *class_name, const zval * #define DISPLAY_ABSTRACT_FN(idx) \ ai.afn[idx] ? ZEND_FN_SCOPE_NAME(ai.afn[idx]) : "", \ ai.afn[idx] ? "::" : "", \ - ai.afn[idx] ? ai.afn[idx]->common.function_name->val : "", \ + ai.afn[idx] ? ZSTR_VAL(ai.afn[idx]->common.function_name) : "", \ ai.afn[idx] && ai.afn[idx + 1] ? ", " : (ai.afn[idx] && ai.cnt > MAX_ABSTRACT_INFO_CNT ? ", ..." : "") typedef struct _zend_abstract_info { @@ -1443,7 +1443,7 @@ void zend_verify_abstract_class(zend_class_entry *ce) /* {{{ */ if (ai.cnt) { zend_error_noreturn(E_ERROR, "Class %s contains %d abstract method%s and must therefore be declared abstract or implement the remaining methods (" MAX_ABSTRACT_INFO_FMT MAX_ABSTRACT_INFO_FMT MAX_ABSTRACT_INFO_FMT ")", - ce->name->val, ai.cnt, + ZSTR_VAL(ce->name), ai.cnt, ai.cnt > 1 ? "s" : "", DISPLAY_ABSTRACT_FN(0), DISPLAY_ABSTRACT_FN(1), @@ -1586,9 +1586,9 @@ ZEND_API int zend_set_local_var(zend_string *name, zval *value, int force) /* {{ zend_string **end = str + op_array->last_var; do { - if ((*str)->h == h && - (*str)->len == name->len && - memcmp((*str)->val, name->val, name->len) == 0) { + if (ZSTR_H(*str) == h && + ZSTR_LEN(*str) == ZSTR_LEN(name) && + memcmp(ZSTR_VAL(*str), ZSTR_VAL(name), ZSTR_LEN(name)) == 0) { zval *var = EX_VAR_NUM(str - op_array->vars); ZVAL_COPY_VALUE(var, value); return SUCCESS; @@ -1627,9 +1627,9 @@ ZEND_API int zend_set_local_var_str(const char *name, size_t len, zval *value, i zend_string **end = str + op_array->last_var; do { - if ((*str)->h == h && - (*str)->len == len && - memcmp((*str)->val, name, len) == 0) { + if (ZSTR_H(*str) == h && + ZSTR_LEN(*str) == len && + memcmp(ZSTR_VAL(*str), name, len) == 0) { zval *var = EX_VAR_NUM(str - op_array->vars); zval_ptr_dtor(var); ZVAL_COPY_VALUE(var, value); diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c index 571c001d85..3642ba5129 100644 --- a/Zend/zend_hash.c +++ b/Zend/zend_hash.c @@ -421,8 +421,8 @@ static zend_always_inline Bucket *zend_hash_find_bucket(const HashTable *ht, zen return p; } else if (EXPECTED(p->h == h) && EXPECTED(p->key) && - EXPECTED(p->key->len == key->len) && - EXPECTED(memcmp(p->key->val, key->val, key->len) == 0)) { + EXPECTED(ZSTR_LEN(p->key) == ZSTR_LEN(key)) && + EXPECTED(memcmp(ZSTR_VAL(p->key), ZSTR_VAL(key), ZSTR_LEN(key)) == 0)) { return p; } idx = Z_NEXT(p->val); @@ -444,8 +444,8 @@ static zend_always_inline Bucket *zend_hash_str_find_bucket(const HashTable *ht, p = HT_HASH_TO_BUCKET_EX(arData, idx); if ((p->h == h) && p->key - && (p->key->len == len) - && !memcmp(p->key->val, str, len)) { + && (ZSTR_LEN(p->key) == len) + && !memcmp(ZSTR_VAL(p->key), str, len)) { return p; } idx = Z_NEXT(p->val); @@ -529,7 +529,7 @@ add_to_hash: ht->u.flags &= ~HASH_FLAG_STATIC_KEYS; zend_string_hash_val(key); } - p->h = h = key->h; + p->h = h = ZSTR_H(key); ZVAL_COPY_VALUE(&p->val, pData); nIndex = h | ht->nTableMask; Z_NEXT(p->val) = HT_HASH(ht, nIndex); @@ -986,8 +986,8 @@ ZEND_API int ZEND_FASTCALL zend_hash_del(HashTable *ht, zend_string *key) if ((p->key == key) || (p->h == h && p->key && - p->key->len == key->len && - memcmp(p->key->val, key->val, key->len) == 0)) { + ZSTR_LEN(p->key) == ZSTR_LEN(key) && + memcmp(ZSTR_VAL(p->key), ZSTR_VAL(key), ZSTR_LEN(key)) == 0)) { _zend_hash_del_el_ex(ht, idx, p, prev); return SUCCESS; } @@ -1017,8 +1017,8 @@ ZEND_API int ZEND_FASTCALL zend_hash_del_ind(HashTable *ht, zend_string *key) if ((p->key == key) || (p->h == h && p->key && - p->key->len == key->len && - memcmp(p->key->val, key->val, key->len) == 0)) { + ZSTR_LEN(p->key) == ZSTR_LEN(key) && + memcmp(ZSTR_VAL(p->key), ZSTR_VAL(key), ZSTR_LEN(key)) == 0)) { if (Z_TYPE(p->val) == IS_INDIRECT) { zval *data = Z_INDIRECT(p->val); @@ -1060,8 +1060,8 @@ ZEND_API int ZEND_FASTCALL zend_hash_str_del_ind(HashTable *ht, const char *str, p = HT_HASH_TO_BUCKET(ht, idx); if ((p->h == h) && p->key - && (p->key->len == len) - && !memcmp(p->key->val, str, len)) { + && (ZSTR_LEN(p->key) == len) + && !memcmp(ZSTR_VAL(p->key), str, len)) { if (Z_TYPE(p->val) == IS_INDIRECT) { zval *data = Z_INDIRECT(p->val); @@ -1103,8 +1103,8 @@ ZEND_API int ZEND_FASTCALL zend_hash_str_del(HashTable *ht, const char *str, siz p = HT_HASH_TO_BUCKET(ht, idx); if ((p->h == h) && p->key - && (p->key->len == len) - && !memcmp(p->key->val, str, len)) { + && (ZSTR_LEN(p->key) == len) + && !memcmp(ZSTR_VAL(p->key), str, len)) { _zend_hash_del_el_ex(ht, idx, p, prev); return SUCCESS; } @@ -2231,11 +2231,11 @@ static zend_always_inline int zend_hash_compare_impl(HashTable *ht1, HashTable * return p1->h > p2->h ? 1 : -1; } } else if (p1->key != NULL && p2->key != NULL) { /* string indices */ - if (p1->key->len != p2->key->len) { - return p1->key->len > p2->key->len ? 1 : -1; + if (ZSTR_LEN(p1->key) != ZSTR_LEN(p2->key)) { + return ZSTR_LEN(p1->key) > ZSTR_LEN(p2->key) ? 1 : -1; } - result = memcmp(p1->key->val, p2->key->val, p1->key->len); + result = memcmp(ZSTR_VAL(p1->key), ZSTR_VAL(p2->key), ZSTR_LEN(p1->key)); if (result != 0) { return result; } diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c index 004aadde34..f1a6d60a2d 100644 --- a/Zend/zend_inheritance.c +++ b/Zend/zend_inheritance.c @@ -142,8 +142,8 @@ static void do_inherit_parent_constructor(zend_class_entry *ce) /* {{{ */ if (ce->constructor) { if (ce->parent->constructor && UNEXPECTED(ce->parent->constructor->common.fn_flags & ZEND_ACC_FINAL)) { zend_error_noreturn(E_ERROR, "Cannot override final %s::%s() with %s::%s()", - ce->parent->name->val, ce->parent->constructor->common.function_name->val, - ce->name->val, ce->constructor->common.function_name->val); + ZSTR_VAL(ce->parent->name), ZSTR_VAL(ce->parent->constructor->common.function_name), + ZSTR_VAL(ce->name), ZSTR_VAL(ce->constructor->common.function_name)); } return; } @@ -183,7 +183,7 @@ static int zend_do_perform_type_hint_check(const zend_function *fe, zend_arg_inf class_name = ((zend_internal_arg_info*)fe_arg_info)->class_name; } else { fe_class_name = fe_arg_info->class_name; - class_name = fe_arg_info->class_name->val; + class_name = ZSTR_VAL(fe_arg_info->class_name); } if (!strcasecmp(class_name, "parent") && proto->common.scope) { fe_class_name = zend_string_copy(proto->common.scope->name); @@ -200,7 +200,7 @@ static int zend_do_perform_type_hint_check(const zend_function *fe, zend_arg_inf class_name = ((zend_internal_arg_info*)proto_arg_info)->class_name; } else { proto_class_name = proto_arg_info->class_name; - class_name = proto_arg_info->class_name->val; + class_name = ZSTR_VAL(proto_arg_info->class_name); } if (!strcasecmp(class_name, "parent") && proto->common.scope && proto->common.scope->parent) { proto_class_name = zend_string_copy(proto->common.scope->parent->name); @@ -212,16 +212,16 @@ static int zend_do_perform_type_hint_check(const zend_function *fe, zend_arg_inf proto_class_name = zend_string_init(class_name, strlen(class_name), 0); } - if (strcasecmp(fe_class_name->val, proto_class_name->val) != 0) { + if (strcasecmp(ZSTR_VAL(fe_class_name), ZSTR_VAL(proto_class_name)) != 0) { const char *colon; if (fe->common.type != ZEND_USER_FUNCTION) { zend_string_release(proto_class_name); zend_string_release(fe_class_name); return 0; - } else if (strchr(proto_class_name->val, '\\') != NULL || - (colon = zend_memrchr(fe_class_name->val, '\\', fe_class_name->len)) == NULL || - strcasecmp(colon+1, proto_class_name->val) != 0) { + } else if (strchr(ZSTR_VAL(proto_class_name), '\\') != NULL || + (colon = zend_memrchr(ZSTR_VAL(fe_class_name), '\\', ZSTR_LEN(fe_class_name))) == NULL || + strcasecmp(colon+1, ZSTR_VAL(proto_class_name)) != 0) { zend_class_entry *fe_ce, *proto_ce; fe_ce = zend_lookup_class(fe_class_name); @@ -355,16 +355,16 @@ static void zend_append_type_hint(smart_str *str, const zend_function *fptr, zen class_name = ((zend_internal_arg_info*)arg_info)->class_name; class_name_len = strlen(class_name); } else { - class_name = arg_info->class_name->val; - class_name_len = arg_info->class_name->len; + class_name = ZSTR_VAL(arg_info->class_name); + class_name_len = ZSTR_LEN(arg_info->class_name); } if (!strcasecmp(class_name, "self") && fptr->common.scope) { - class_name = fptr->common.scope->name->val; - class_name_len = fptr->common.scope->name->len; + class_name = ZSTR_VAL(fptr->common.scope->name); + class_name_len = ZSTR_LEN(fptr->common.scope->name); } else if (!strcasecmp(class_name, "parent") && fptr->common.scope && fptr->common.scope->parent) { - class_name = fptr->common.scope->parent->name->val; - class_name_len = fptr->common.scope->parent->name->len; + class_name = ZSTR_VAL(fptr->common.scope->parent->name); + class_name_len = ZSTR_LEN(fptr->common.scope->parent->name); } smart_str_appendl(str, class_name, class_name_len); @@ -395,7 +395,7 @@ static zend_string *zend_get_function_declaration(const zend_function *fptr) /* if (fptr->common.scope) { /* cut off on NULL byte ... class@anonymous */ - smart_str_appendl(&str, fptr->common.scope->name->val, strlen(fptr->common.scope->name->val)); + smart_str_appendl(&str, ZSTR_VAL(fptr->common.scope->name), strlen(ZSTR_VAL(fptr->common.scope->name))); smart_str_appends(&str, "::"); } @@ -428,7 +428,7 @@ static zend_string *zend_get_function_declaration(const zend_function *fptr) /* if (fptr->type == ZEND_INTERNAL_FUNCTION) { smart_str_appends(&str, ((zend_internal_arg_info*)arg_info)->name); } else { - smart_str_appendl(&str, arg_info->name->val, arg_info->name->len); + smart_str_appendl(&str, ZSTR_VAL(arg_info->name), ZSTR_LEN(arg_info->name)); } } else { smart_str_appends(&str, "param"); @@ -516,13 +516,13 @@ static void do_inheritance_check_on_method(zend_function *child, zend_function * && parent->common.scope != (child->common.prototype ? child->common.prototype->common.scope : child->common.scope) && child->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_IMPLEMENTED_ABSTRACT)) { zend_error_noreturn(E_COMPILE_ERROR, "Can't inherit abstract function %s::%s() (previously declared abstract in %s)", - parent->common.scope->name->val, - child->common.function_name->val, - child->common.prototype ? child->common.prototype->common.scope->name->val : child->common.scope->name->val); + ZSTR_VAL(parent->common.scope->name), + ZSTR_VAL(child->common.function_name), + child->common.prototype ? ZSTR_VAL(child->common.prototype->common.scope->name) : ZSTR_VAL(child->common.scope->name)); } if (UNEXPECTED(parent_flags & ZEND_ACC_FINAL)) { - zend_error_noreturn(E_COMPILE_ERROR, "Cannot override final method %s::%s()", ZEND_FN_SCOPE_NAME(parent), child->common.function_name->val); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot override final method %s::%s()", ZEND_FN_SCOPE_NAME(parent), ZSTR_VAL(child->common.function_name)); } child_flags = child->common.fn_flags; @@ -530,15 +530,15 @@ static void do_inheritance_check_on_method(zend_function *child, zend_function * */ if (UNEXPECTED((child_flags & ZEND_ACC_STATIC) != (parent_flags & ZEND_ACC_STATIC))) { if (child->common.fn_flags & ZEND_ACC_STATIC) { - zend_error_noreturn(E_COMPILE_ERROR, "Cannot make non static method %s::%s() static in class %s", ZEND_FN_SCOPE_NAME(parent), child->common.function_name->val, ZEND_FN_SCOPE_NAME(child)); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot make non static method %s::%s() static in class %s", ZEND_FN_SCOPE_NAME(parent), ZSTR_VAL(child->common.function_name), ZEND_FN_SCOPE_NAME(child)); } else { - zend_error_noreturn(E_COMPILE_ERROR, "Cannot make static method %s::%s() non static in class %s", ZEND_FN_SCOPE_NAME(parent), child->common.function_name->val, ZEND_FN_SCOPE_NAME(child)); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot make static method %s::%s() non static in class %s", ZEND_FN_SCOPE_NAME(parent), ZSTR_VAL(child->common.function_name), ZEND_FN_SCOPE_NAME(child)); } } /* Disallow making an inherited method abstract. */ if (UNEXPECTED((child_flags & ZEND_ACC_ABSTRACT) > (parent_flags & ZEND_ACC_ABSTRACT))) { - zend_error_noreturn(E_COMPILE_ERROR, "Cannot make non abstract method %s::%s() abstract in class %s", ZEND_FN_SCOPE_NAME(parent), child->common.function_name->val, ZEND_FN_SCOPE_NAME(child)); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot make non abstract method %s::%s() abstract in class %s", ZEND_FN_SCOPE_NAME(parent), ZSTR_VAL(child->common.function_name), ZEND_FN_SCOPE_NAME(child)); } if (parent_flags & ZEND_ACC_CHANGED) { @@ -547,7 +547,7 @@ static void do_inheritance_check_on_method(zend_function *child, zend_function * /* Prevent derived classes from restricting access that was available in parent classes */ if (UNEXPECTED((child_flags & ZEND_ACC_PPP_MASK) > (parent_flags & ZEND_ACC_PPP_MASK))) { - zend_error_noreturn(E_COMPILE_ERROR, "Access level to %s::%s() must be %s (as in class %s)%s", ZEND_FN_SCOPE_NAME(child), child->common.function_name->val, zend_visibility_string(parent_flags), ZEND_FN_SCOPE_NAME(parent), (parent_flags&ZEND_ACC_PUBLIC) ? "" : " or weaker"); + zend_error_noreturn(E_COMPILE_ERROR, "Access level to %s::%s() must be %s (as in class %s)%s", ZEND_FN_SCOPE_NAME(child), ZSTR_VAL(child->common.function_name), zend_visibility_string(parent_flags), ZEND_FN_SCOPE_NAME(parent), (parent_flags&ZEND_ACC_PUBLIC) ? "" : " or weaker"); } else if (((child_flags & ZEND_ACC_PPP_MASK) < (parent_flags & ZEND_ACC_PPP_MASK)) && ((parent_flags & ZEND_ACC_PPP_MASK) & ZEND_ACC_PRIVATE)) { child->common.fn_flags |= ZEND_ACC_CHANGED; @@ -570,12 +570,12 @@ static void do_inheritance_check_on_method(zend_function *child, zend_function * if (UNEXPECTED(!zend_do_perform_implementation_check(child, child->common.prototype))) { zend_string *method_prototype = zend_get_function_declaration(child->common.prototype); zend_string *child_prototype = zend_get_function_declaration(child); - zend_error_noreturn(E_COMPILE_ERROR, "Declaration of %s must be compatible with %s", child_prototype->val, method_prototype->val); + zend_error_noreturn(E_COMPILE_ERROR, "Declaration of %s must be compatible with %s", ZSTR_VAL(child_prototype), ZSTR_VAL(method_prototype)); } } else if (UNEXPECTED(!zend_do_perform_implementation_check(child, parent))) { zend_string *method_prototype = zend_get_function_declaration(parent); zend_string *child_prototype = zend_get_function_declaration(child); - zend_error(E_WARNING, "Declaration of %s should be compatible with %s", child_prototype->val, method_prototype->val); + zend_error(E_WARNING, "Declaration of %s should be compatible with %s", ZSTR_VAL(child_prototype), ZSTR_VAL(method_prototype)); zend_string_free(child_prototype); zend_string_free(method_prototype); } @@ -611,8 +611,8 @@ static void do_inherit_property(zend_property_info *parent_info, zend_string *ke } else { if (UNEXPECTED((parent_info->flags & ZEND_ACC_STATIC) != (child_info->flags & ZEND_ACC_STATIC))) { zend_error_noreturn(E_COMPILE_ERROR, "Cannot redeclare %s%s::$%s as %s%s::$%s", - (parent_info->flags & ZEND_ACC_STATIC) ? "static " : "non static ", ce->parent->name->val, key->val, - (child_info->flags & ZEND_ACC_STATIC) ? "static " : "non static ", ce->name->val, key->val); + (parent_info->flags & ZEND_ACC_STATIC) ? "static " : "non static ", ZSTR_VAL(ce->parent->name), ZSTR_VAL(key), + (child_info->flags & ZEND_ACC_STATIC) ? "static " : "non static ", ZSTR_VAL(ce->name), ZSTR_VAL(key)); } if (parent_info->flags & ZEND_ACC_CHANGED) { @@ -620,7 +620,7 @@ static void do_inherit_property(zend_property_info *parent_info, zend_string *ke } if (UNEXPECTED((child_info->flags & ZEND_ACC_PPP_MASK) > (parent_info->flags & ZEND_ACC_PPP_MASK))) { - zend_error_noreturn(E_COMPILE_ERROR, "Access level to %s::$%s must be %s (as in class %s)%s", ce->name->val, key->val, zend_visibility_string(parent_info->flags), ce->parent->name->val, (parent_info->flags&ZEND_ACC_PUBLIC) ? "" : " or weaker"); + zend_error_noreturn(E_COMPILE_ERROR, "Access level to %s::$%s must be %s (as in class %s)%s", ZSTR_VAL(ce->name), ZSTR_VAL(key), zend_visibility_string(parent_info->flags), ZSTR_VAL(ce->parent->name), (parent_info->flags&ZEND_ACC_PUBLIC) ? "" : " or weaker"); } else if ((child_info->flags & ZEND_ACC_STATIC) == 0) { int parent_num = OBJ_PROP_TO_NUM(parent_info->offset); int child_num = OBJ_PROP_TO_NUM(child_info->offset); @@ -655,10 +655,10 @@ static void do_inherit_property(zend_property_info *parent_info, zend_string *ke static inline void do_implement_interface(zend_class_entry *ce, zend_class_entry *iface) /* {{{ */ { if (!(ce->ce_flags & ZEND_ACC_INTERFACE) && iface->interface_gets_implemented && iface->interface_gets_implemented(iface, ce) == FAILURE) { - zend_error_noreturn(E_CORE_ERROR, "Class %s could not implement interface %s", ce->name->val, iface->name->val); + zend_error_noreturn(E_CORE_ERROR, "Class %s could not implement interface %s", ZSTR_VAL(ce->name), ZSTR_VAL(iface->name)); } if (UNEXPECTED(ce == iface)) { - zend_error_noreturn(E_ERROR, "Interface %s cannot implement itself", ce->name->val); + zend_error_noreturn(E_ERROR, "Interface %s cannot implement itself", ZSTR_VAL(ce->name)); } } /* }}} */ @@ -729,19 +729,19 @@ ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent if (UNEXPECTED(ce->ce_flags & ZEND_ACC_INTERFACE)) { /* Interface can only inherit other interfaces */ if (UNEXPECTED(!(parent_ce->ce_flags & ZEND_ACC_INTERFACE))) { - zend_error_noreturn(E_COMPILE_ERROR, "Interface %s may not inherit from class (%s)", ce->name->val, parent_ce->name->val); + zend_error_noreturn(E_COMPILE_ERROR, "Interface %s may not inherit from class (%s)", ZSTR_VAL(ce->name), ZSTR_VAL(parent_ce->name)); } } else if (UNEXPECTED(parent_ce->ce_flags & (ZEND_ACC_INTERFACE|ZEND_ACC_TRAIT|ZEND_ACC_FINAL))) { /* Class declaration must not extend traits or interfaces */ if (parent_ce->ce_flags & ZEND_ACC_INTERFACE) { - zend_error_noreturn(E_COMPILE_ERROR, "Class %s cannot extend from interface %s", ce->name->val, parent_ce->name->val); + zend_error_noreturn(E_COMPILE_ERROR, "Class %s cannot extend from interface %s", ZSTR_VAL(ce->name), ZSTR_VAL(parent_ce->name)); } else if (parent_ce->ce_flags & ZEND_ACC_TRAIT) { - zend_error_noreturn(E_COMPILE_ERROR, "Class %s cannot extend from trait %s", ce->name->val, parent_ce->name->val); + zend_error_noreturn(E_COMPILE_ERROR, "Class %s cannot extend from trait %s", ZSTR_VAL(ce->name), ZSTR_VAL(parent_ce->name)); } /* Class must not extend a final class */ if (parent_ce->ce_flags & ZEND_ACC_FINAL) { - zend_error_noreturn(E_COMPILE_ERROR, "Class %s may not inherit from final class (%s)", ce->name->val, parent_ce->name->val); + zend_error_noreturn(E_COMPILE_ERROR, "Class %s may not inherit from final class (%s)", ZSTR_VAL(ce->name), ZSTR_VAL(parent_ce->name)); } } @@ -896,7 +896,7 @@ static zend_bool do_inherit_constant_check(HashTable *child_constants_table, zva if (!Z_ISREF_P(old_constant) || !Z_ISREF_P(parent_constant) || Z_REFVAL_P(old_constant) != Z_REFVAL_P(parent_constant)) { - zend_error_noreturn(E_COMPILE_ERROR, "Cannot inherit previously-inherited or override constant %s from interface %s", name->val, iface->name->val); + zend_error_noreturn(E_COMPILE_ERROR, "Cannot inherit previously-inherited or override constant %s from interface %s", ZSTR_VAL(name), ZSTR_VAL(iface->name)); } return 0; } @@ -934,7 +934,7 @@ ZEND_API void zend_do_implement_interface(zend_class_entry *ce, zend_class_entry if (EXPECTED(i < parent_iface_num)) { ignore = 1; } else { - zend_error_noreturn(E_COMPILE_ERROR, "Class %s cannot implement previously implemented interface %s", ce->name->val, iface->name->val); + zend_error_noreturn(E_COMPILE_ERROR, "Class %s cannot implement previously implemented interface %s", ZSTR_VAL(ce->name), ZSTR_VAL(iface->name)); } } } @@ -1014,41 +1014,41 @@ static zend_bool zend_traits_method_compatibility_check(zend_function *fn, zend_ static void zend_add_magic_methods(zend_class_entry* ce, zend_string* mname, zend_function* fe) /* {{{ */ { - if (!strncmp(mname->val, ZEND_CLONE_FUNC_NAME, mname->len)) { + if (!strncmp(ZSTR_VAL(mname), ZEND_CLONE_FUNC_NAME, ZSTR_LEN(mname))) { ce->clone = fe; fe->common.fn_flags |= ZEND_ACC_CLONE; - } else if (!strncmp(mname->val, ZEND_CONSTRUCTOR_FUNC_NAME, mname->len)) { + } else if (!strncmp(ZSTR_VAL(mname), ZEND_CONSTRUCTOR_FUNC_NAME, ZSTR_LEN(mname))) { if (ce->constructor && (!ce->parent || ce->constructor != ce->parent->constructor)) { - zend_error_noreturn(E_COMPILE_ERROR, "%s has colliding constructor definitions coming from traits", ce->name->val); + zend_error_noreturn(E_COMPILE_ERROR, "%s has colliding constructor definitions coming from traits", ZSTR_VAL(ce->name)); } ce->constructor = fe; fe->common.fn_flags |= ZEND_ACC_CTOR; - } else if (!strncmp(mname->val, ZEND_DESTRUCTOR_FUNC_NAME, mname->len)) { + } else if (!strncmp(ZSTR_VAL(mname), ZEND_DESTRUCTOR_FUNC_NAME, ZSTR_LEN(mname))) { ce->destructor = fe; fe->common.fn_flags |= ZEND_ACC_DTOR; - } else if (!strncmp(mname->val, ZEND_GET_FUNC_NAME, mname->len)) { + } else if (!strncmp(ZSTR_VAL(mname), ZEND_GET_FUNC_NAME, ZSTR_LEN(mname))) { ce->__get = fe; ce->ce_flags |= ZEND_ACC_USE_GUARDS; - } else if (!strncmp(mname->val, ZEND_SET_FUNC_NAME, mname->len)) { + } else if (!strncmp(ZSTR_VAL(mname), ZEND_SET_FUNC_NAME, ZSTR_LEN(mname))) { ce->__set = fe; ce->ce_flags |= ZEND_ACC_USE_GUARDS; - } else if (!strncmp(mname->val, ZEND_CALL_FUNC_NAME, mname->len)) { + } else if (!strncmp(ZSTR_VAL(mname), ZEND_CALL_FUNC_NAME, ZSTR_LEN(mname))) { ce->__call = fe; - } else if (!strncmp(mname->val, ZEND_UNSET_FUNC_NAME, mname->len)) { + } else if (!strncmp(ZSTR_VAL(mname), ZEND_UNSET_FUNC_NAME, ZSTR_LEN(mname))) { ce->__unset = fe; ce->ce_flags |= ZEND_ACC_USE_GUARDS; - } else if (!strncmp(mname->val, ZEND_ISSET_FUNC_NAME, mname->len)) { + } else if (!strncmp(ZSTR_VAL(mname), ZEND_ISSET_FUNC_NAME, ZSTR_LEN(mname))) { ce->__isset = fe; ce->ce_flags |= ZEND_ACC_USE_GUARDS; - } else if (!strncmp(mname->val, ZEND_CALLSTATIC_FUNC_NAME, mname->len)) { + } else if (!strncmp(ZSTR_VAL(mname), ZEND_CALLSTATIC_FUNC_NAME, ZSTR_LEN(mname))) { ce->__callstatic = fe; - } else if (!strncmp(mname->val, ZEND_TOSTRING_FUNC_NAME, mname->len)) { + } else if (!strncmp(ZSTR_VAL(mname), ZEND_TOSTRING_FUNC_NAME, ZSTR_LEN(mname))) { ce->__tostring = fe; - } else if (!strncmp(mname->val, ZEND_DEBUGINFO_FUNC_NAME, mname->len)) { + } else if (!strncmp(ZSTR_VAL(mname), ZEND_DEBUGINFO_FUNC_NAME, ZSTR_LEN(mname))) { ce->__debugInfo = fe; - } else if (ce->name->len == mname->len) { + } else if (ZSTR_LEN(ce->name) == ZSTR_LEN(mname)) { zend_string *lowercase_name = zend_string_tolower(ce->name); lowercase_name = zend_new_interned_string(lowercase_name); - if (!memcmp(mname->val, lowercase_name->val, mname->len)) { + if (!memcmp(ZSTR_VAL(mname), ZSTR_VAL(lowercase_name), ZSTR_LEN(mname))) { if (ce->constructor && (!ce->parent || ce->constructor != ce->parent->constructor)) { - zend_error_noreturn(E_COMPILE_ERROR, "%s has colliding constructor definitions coming from traits", ce->name->val); + zend_error_noreturn(E_COMPILE_ERROR, "%s has colliding constructor definitions coming from traits", ZSTR_VAL(ce->name)); } ce->constructor = fe; fe->common.fn_flags |= ZEND_ACC_CTOR; @@ -1073,15 +1073,15 @@ static void zend_add_trait_method(zend_class_entry *ce, const char *name, zend_s /* Make sure the trait method is compatible with previosly declared abstract method */ if (UNEXPECTED(!zend_traits_method_compatibility_check(fn, existing_fn))) { zend_error_noreturn(E_COMPILE_ERROR, "Declaration of %s must be compatible with %s", - zend_get_function_declaration(fn)->val, - zend_get_function_declaration(existing_fn)->val); + ZSTR_VAL(zend_get_function_declaration(fn)), + ZSTR_VAL(zend_get_function_declaration(existing_fn))); } } else if (fn->common.fn_flags & ZEND_ACC_ABSTRACT) { /* Make sure the abstract declaration is compatible with previous declaration */ if (UNEXPECTED(!zend_traits_method_compatibility_check(existing_fn, fn))) { zend_error_noreturn(E_COMPILE_ERROR, "Declaration of %s must be compatible with %s", - zend_get_function_declaration(fn)->val, - zend_get_function_declaration(existing_fn)->val); + ZSTR_VAL(zend_get_function_declaration(fn)), + ZSTR_VAL(zend_get_function_declaration(existing_fn))); } return; } @@ -1097,27 +1097,27 @@ static void zend_add_trait_method(zend_class_entry *ce, const char *name, zend_s /* Make sure the trait method is compatible with previosly declared abstract method */ if (UNEXPECTED(!zend_traits_method_compatibility_check(fn, existing_fn))) { zend_error_noreturn(E_COMPILE_ERROR, "Declaration of %s must be compatible with %s", - zend_get_function_declaration(fn)->val, - zend_get_function_declaration(existing_fn)->val); + ZSTR_VAL(zend_get_function_declaration(fn)), + ZSTR_VAL(zend_get_function_declaration(existing_fn))); } } else if (fn->common.fn_flags & ZEND_ACC_ABSTRACT) { /* Make sure the abstract declaration is compatible with previous declaration */ if (UNEXPECTED(!zend_traits_method_compatibility_check(existing_fn, fn))) { zend_error_noreturn(E_COMPILE_ERROR, "Declaration of %s must be compatible with %s", - zend_get_function_declaration(fn)->val, - zend_get_function_declaration(existing_fn)->val); + ZSTR_VAL(zend_get_function_declaration(fn)), + ZSTR_VAL(zend_get_function_declaration(existing_fn))); } return; } else if (UNEXPECTED(existing_fn->common.scope->ce_flags & ZEND_ACC_TRAIT)) { /* two traits can't define the same non-abstract method */ #if 1 zend_error_noreturn(E_COMPILE_ERROR, "Trait method %s has not been applied, because there are collisions with other trait methods on %s", - name, ce->name->val); + name, ZSTR_VAL(ce->name)); #else /* TODO: better error message */ zend_error_noreturn(E_COMPILE_ERROR, "Trait method %s::%s has not been applied as %s::%s, because of collision with %s::%s", - fn->common.scope->name->val, fn->common.function_name->val, - ce->name->val, name, - existing_fn->common.scope->name->val, existing_fn->common.function_name->val); + ZSTR_VAL(fn->common.scope->name), ZSTR_VAL(fn->common.function_name), + ZSTR_VAL(ce->name), name, + ZSTR_VAL(existing_fn->common.scope->name), ZSTR_VAL(existing_fn->common.function_name)); #endif } else { /* inherited members are overridden by members inserted by traits */ @@ -1165,8 +1165,8 @@ static int zend_traits_copy_functions(zend_string *fnname, zend_function *fn, ze /* Scope unset or equal to the function we compare to, and the alias applies to fn */ if (alias->alias != NULL && (!alias->trait_method->ce || fn->common.scope == alias->trait_method->ce) - && alias->trait_method->method_name->len == fnname->len - && (zend_binary_strcasecmp(alias->trait_method->method_name->val, alias->trait_method->method_name->len, fnname->val, fnname->len) == 0)) { + && ZSTR_LEN(alias->trait_method->method_name) == ZSTR_LEN(fnname) + && (zend_binary_strcasecmp(ZSTR_VAL(alias->trait_method->method_name), ZSTR_LEN(alias->trait_method->method_name), ZSTR_VAL(fnname), ZSTR_LEN(fnname)) == 0)) { fn_copy = *fn; /* if it is 0, no modifieres has been changed */ @@ -1175,7 +1175,7 @@ static int zend_traits_copy_functions(zend_string *fnname, zend_function *fn, ze } lcname = zend_string_tolower(alias->alias); - zend_add_trait_method(ce, alias->alias->val, lcname, &fn_copy, overriden); + zend_add_trait_method(ce, ZSTR_VAL(alias->alias), lcname, &fn_copy, overriden); zend_string_release(lcname); /* Record the trait from which this alias was resolved. */ @@ -1200,8 +1200,8 @@ static int zend_traits_copy_functions(zend_string *fnname, zend_function *fn, ze /* Scope unset or equal to the function we compare to, and the alias applies to fn */ if (alias->alias == NULL && alias->modifiers != 0 && (!alias->trait_method->ce || fn->common.scope == alias->trait_method->ce) - && (alias->trait_method->method_name->len == fnname->len) - && (zend_binary_strcasecmp(alias->trait_method->method_name->val, alias->trait_method->method_name->len, fnname->val, fnname->len) == 0)) { + && (ZSTR_LEN(alias->trait_method->method_name) == ZSTR_LEN(fnname)) + && (zend_binary_strcasecmp(ZSTR_VAL(alias->trait_method->method_name), ZSTR_LEN(alias->trait_method->method_name), ZSTR_VAL(fnname), ZSTR_LEN(fnname)) == 0)) { fn_copy.common.fn_flags = alias->modifiers | (fn->common.fn_flags ^ (fn->common.fn_flags & ZEND_ACC_PPP_MASK)); @@ -1215,7 +1215,7 @@ static int zend_traits_copy_functions(zend_string *fnname, zend_function *fn, ze } } - zend_add_trait_method(ce, fn->common.function_name->val, fnname, &fn_copy, overriden); + zend_add_trait_method(ce, ZSTR_VAL(fn->common.function_name), fnname, &fn_copy, overriden); } return ZEND_HASH_APPLY_KEEP; @@ -1227,7 +1227,7 @@ static void zend_check_trait_usage(zend_class_entry *ce, zend_class_entry *trait uint32_t i; if (UNEXPECTED((trait->ce_flags & ZEND_ACC_TRAIT) != ZEND_ACC_TRAIT)) { - zend_error_noreturn(E_COMPILE_ERROR, "Class %s is not a trait, Only traits may be used in 'as' and 'insteadof' statements", trait->name->val); + zend_error_noreturn(E_COMPILE_ERROR, "Class %s is not a trait, Only traits may be used in 'as' and 'insteadof' statements", ZSTR_VAL(trait->name)); } for (i = 0; i < ce->num_traits; i++) { @@ -1235,7 +1235,7 @@ static void zend_check_trait_usage(zend_class_entry *ce, zend_class_entry *trait return; } } - zend_error_noreturn(E_COMPILE_ERROR, "Required Trait %s wasn't added to %s", trait->name->val, ce->name->val); + zend_error_noreturn(E_COMPILE_ERROR, "Required Trait %s wasn't added to %s", ZSTR_VAL(trait->name), ZSTR_VAL(ce->name)); } /* }}} */ @@ -1259,7 +1259,7 @@ static void zend_traits_init_trait_structures(zend_class_entry *ce) /* {{{ */ cur_method_ref = cur_precedence->trait_method; if (!(cur_precedence->trait_method->ce = zend_fetch_class(cur_method_ref->class_name, ZEND_FETCH_CLASS_TRAIT|ZEND_FETCH_CLASS_NO_AUTOLOAD))) { - zend_error_noreturn(E_COMPILE_ERROR, "Could not find trait %s", cur_method_ref->class_name->val); + zend_error_noreturn(E_COMPILE_ERROR, "Could not find trait %s", ZSTR_VAL(cur_method_ref->class_name)); } zend_check_trait_usage(ce, cur_precedence->trait_method->ce); @@ -1271,8 +1271,8 @@ static void zend_traits_init_trait_structures(zend_class_entry *ce) /* {{{ */ if (!method_exists) { zend_error_noreturn(E_COMPILE_ERROR, "A precedence rule was defined for %s::%s but this method does not exist", - cur_method_ref->ce->name->val, - cur_method_ref->method_name->val); + ZSTR_VAL(cur_method_ref->ce->name), + ZSTR_VAL(cur_method_ref->method_name)); } /** With the other traits, we are more permissive. @@ -1286,7 +1286,7 @@ static void zend_traits_init_trait_structures(zend_class_entry *ce) /* {{{ */ zend_string* class_name = cur_precedence->exclude_from_classes[j].class_name; if (!(cur_precedence->exclude_from_classes[j].ce = zend_fetch_class(class_name, ZEND_FETCH_CLASS_TRAIT |ZEND_FETCH_CLASS_NO_AUTOLOAD))) { - zend_error_noreturn(E_COMPILE_ERROR, "Could not find trait %s", class_name->val); + zend_error_noreturn(E_COMPILE_ERROR, "Could not find trait %s", ZSTR_VAL(class_name)); } zend_check_trait_usage(ce, cur_precedence->exclude_from_classes[j].ce); @@ -1296,9 +1296,9 @@ static void zend_traits_init_trait_structures(zend_class_entry *ce) /* {{{ */ zend_error_noreturn(E_COMPILE_ERROR, "Inconsistent insteadof definition. " "The method %s is to be used from %s, but %s is also on the exclude list", - cur_method_ref->method_name->val, - cur_precedence->trait_method->ce->name->val, - cur_precedence->trait_method->ce->name->val); + ZSTR_VAL(cur_method_ref->method_name), + ZSTR_VAL(cur_precedence->trait_method->ce->name), + ZSTR_VAL(cur_precedence->trait_method->ce->name)); } zend_string_release(class_name); @@ -1317,7 +1317,7 @@ static void zend_traits_init_trait_structures(zend_class_entry *ce) /* {{{ */ if (ce->trait_aliases[i]->trait_method->class_name) { cur_method_ref = ce->trait_aliases[i]->trait_method; if (!(cur_method_ref->ce = zend_fetch_class(cur_method_ref->class_name, ZEND_FETCH_CLASS_TRAIT|ZEND_FETCH_CLASS_NO_AUTOLOAD))) { - zend_error_noreturn(E_COMPILE_ERROR, "Could not find trait %s", cur_method_ref->class_name->val); + zend_error_noreturn(E_COMPILE_ERROR, "Could not find trait %s", ZSTR_VAL(cur_method_ref->class_name)); } zend_check_trait_usage(ce, cur_method_ref->ce); @@ -1328,7 +1328,7 @@ static void zend_traits_init_trait_structures(zend_class_entry *ce) /* {{{ */ zend_string_release(lcname); if (!method_exists) { - zend_error_noreturn(E_COMPILE_ERROR, "An alias was defined for %s::%s but this method does not exist", cur_method_ref->ce->name->val, cur_method_ref->method_name->val); + zend_error_noreturn(E_COMPILE_ERROR, "An alias was defined for %s::%s but this method does not exist", ZSTR_VAL(cur_method_ref->ce->name), ZSTR_VAL(cur_method_ref->method_name)); } } i++; @@ -1353,7 +1353,7 @@ static void zend_traits_compile_exclude_table(HashTable* exclude_table, zend_tra zend_string_tolower(precedences[i]->trait_method->method_name); if (zend_hash_add_empty_element(exclude_table, lcname) == NULL) { zend_string_release(lcname); - zend_error_noreturn(E_COMPILE_ERROR, "Failed to evaluate a trait precedence (%s). Method of trait %s was defined to be excluded multiple times", precedences[i]->trait_method->method_name->val, trait->name->val); + zend_error_noreturn(E_COMPILE_ERROR, "Failed to evaluate a trait precedence (%s). Method of trait %s was defined to be excluded multiple times", ZSTR_VAL(precedences[i]->trait_method->method_name), ZSTR_VAL(trait->name)); } zend_string_release(lcname); } @@ -1504,10 +1504,10 @@ static void zend_do_traits_property_binding(zend_class_entry *ce) /* {{{ */ if (not_compatible) { zend_error_noreturn(E_COMPILE_ERROR, "%s and %s define the same property ($%s) in the composition of %s. However, the definition differs and is considered incompatible. Class was composed", - find_first_definition(ce, i, prop_name, coliding_prop->ce)->name->val, - property_info->ce->name->val, - prop_name->val, - ce->name->val); + ZSTR_VAL(find_first_definition(ce, i, prop_name, coliding_prop->ce)->name), + ZSTR_VAL(property_info->ce->name), + ZSTR_VAL(prop_name), + ZSTR_VAL(ce->name)); } zend_string_release(prop_name); @@ -1549,8 +1549,8 @@ static void zend_do_check_for_inconsistent_traits_aliasing(zend_class_entry *ce) /** Plain old inconsistency/typo/bug */ zend_error_noreturn(E_COMPILE_ERROR, "An alias (%s) was defined for method %s(), but this method does not exist", - cur_alias->alias->val, - cur_alias->trait_method->method_name->val); + ZSTR_VAL(cur_alias->alias), + ZSTR_VAL(cur_alias->trait_method->method_name)); } else { /** Here are two possible cases: 1) this is an attempt to modifiy the visibility @@ -1567,12 +1567,12 @@ static void zend_do_check_for_inconsistent_traits_aliasing(zend_class_entry *ce) zend_string_release(lc_method_name); zend_error_noreturn(E_COMPILE_ERROR, "The modifiers for the trait alias %s() need to be changed in the same statement in which the alias is defined. Error", - cur_alias->trait_method->method_name->val); + ZSTR_VAL(cur_alias->trait_method->method_name)); } else { zend_string_release(lc_method_name); zend_error_noreturn(E_COMPILE_ERROR, "The modifiers of the trait method %s() are changed, but this method does not exist. Error", - cur_alias->trait_method->method_name->val); + ZSTR_VAL(cur_alias->trait_method->method_name)); } } @@ -1624,8 +1624,8 @@ static zend_bool zend_has_deprecated_constructor(const zend_class_entry *ce) /* } constructor_name = ce->constructor->common.function_name; return !zend_binary_strcasecmp( - ce->name->val, ce->name->len, - constructor_name->val, constructor_name->len + ZSTR_VAL(ce->name), ZSTR_LEN(ce->name), + ZSTR_VAL(constructor_name), ZSTR_LEN(constructor_name) ); } /* }}} */ @@ -1633,7 +1633,7 @@ static zend_bool zend_has_deprecated_constructor(const zend_class_entry *ce) /* void zend_check_deprecated_constructor(const zend_class_entry *ce) /* {{{ */ { if (zend_has_deprecated_constructor(ce)) { - zend_error(E_DEPRECATED, "Methods with the same name as their class will not be constructors in a future version of PHP; %s has a deprecated constructor", ce->name->val); + zend_error(E_DEPRECATED, "Methods with the same name as their class will not be constructors in a future version of PHP; %s has a deprecated constructor", ZSTR_VAL(ce->name)); } } /* }}} */ diff --git a/Zend/zend_ini.c b/Zend/zend_ini.c index 896430d150..d7ff106454 100644 --- a/Zend/zend_ini.c +++ b/Zend/zend_ini.c @@ -157,13 +157,13 @@ static void copy_ini_entry(zval *zv) /* {{{ */ Z_PTR_P(zv) = new_entry; memcpy(new_entry, old_entry, sizeof(zend_ini_entry)); if (old_entry->name) { - new_entry->name = zend_string_init(old_entry->name->val, old_entry->name->len, 1); + new_entry->name = zend_string_init(ZSTR_VAL(old_entry->name), ZSTR_LEN(old_entry->name), 1); } if (old_entry->value) { - new_entry->value = zend_string_init(old_entry->value->val, old_entry->value->len, 1); + new_entry->value = zend_string_init(ZSTR_VAL(old_entry->value), ZSTR_LEN(old_entry->value), 1); } if (old_entry->orig_value) { - new_entry->orig_value = zend_string_init(old_entry->orig_value->val, old_entry->orig_value->len, 1); + new_entry->orig_value = zend_string_init(ZSTR_VAL(old_entry->orig_value), ZSTR_LEN(old_entry->orig_value), 1); } } /* }}} */ @@ -195,7 +195,7 @@ static int ini_key_compare(const void *a, const void *b) /* {{{ */ } else if (!s->key) { /* s is numeric, f is not */ return 1; } else { /* both strings */ - return zend_binary_strcasecmp(f->key->val, f->key->len, s->key->val, s->key->len); + return zend_binary_strcasecmp(ZSTR_VAL(f->key), ZSTR_LEN(f->key), ZSTR_VAL(s->key), ZSTR_LEN(s->key)); } } /* }}} */ @@ -425,9 +425,9 @@ ZEND_API zend_long zend_ini_long(char *name, uint name_length, int orig) /* {{{ ini_entry = zend_hash_str_find_ptr(EG(ini_directives), name, name_length); if (ini_entry) { if (orig && ini_entry->modified) { - return (ini_entry->orig_value ? ZEND_STRTOL(ini_entry->orig_value->val, NULL, 0) : 0); + return (ini_entry->orig_value ? ZEND_STRTOL(ZSTR_VAL(ini_entry->orig_value), NULL, 0) : 0); } else { - return (ini_entry->value ? ZEND_STRTOL(ini_entry->value->val, NULL, 0) : 0); + return (ini_entry->value ? ZEND_STRTOL(ZSTR_VAL(ini_entry->value), NULL, 0) : 0); } } @@ -442,9 +442,9 @@ ZEND_API double zend_ini_double(char *name, uint name_length, int orig) /* {{{ * ini_entry = zend_hash_str_find_ptr(EG(ini_directives), name, name_length); if (ini_entry) { if (orig && ini_entry->modified) { - return (double) (ini_entry->orig_value ? zend_strtod(ini_entry->orig_value->val, NULL) : 0.0); + return (double) (ini_entry->orig_value ? zend_strtod(ZSTR_VAL(ini_entry->orig_value), NULL) : 0.0); } else { - return (double) (ini_entry->value ? zend_strtod(ini_entry->value->val, NULL) : 0.0); + return (double) (ini_entry->value ? zend_strtod(ZSTR_VAL(ini_entry->value), NULL) : 0.0); } } @@ -463,9 +463,9 @@ ZEND_API char *zend_ini_string_ex(char *name, uint name_length, int orig, zend_b } if (orig && ini_entry->modified) { - return ini_entry->orig_value ? ini_entry->orig_value->val : NULL; + return ini_entry->orig_value ? ZSTR_VAL(ini_entry->orig_value) : NULL; } else { - return ini_entry->value ? ini_entry->value->val : NULL; + return ini_entry->value ? ZSTR_VAL(ini_entry->value) : NULL; } } else { if (exists) { @@ -545,14 +545,14 @@ ZEND_INI_DISP(zend_ini_boolean_displayer_cb) /* {{{ */ } if (tmp_value) { - if (tmp_value->len == 4 && strcasecmp(tmp_value->val, "true") == 0) { + if (ZSTR_LEN(tmp_value) == 4 && strcasecmp(ZSTR_VAL(tmp_value), "true") == 0) { value = 1; - } else if (tmp_value->len == 3 && strcasecmp(tmp_value->val, "yes") == 0) { + } else if (ZSTR_LEN(tmp_value) == 3 && strcasecmp(ZSTR_VAL(tmp_value), "yes") == 0) { value = 1; - } else if (tmp_value->len == 2 && strcasecmp(tmp_value->val, "on") == 0) { + } else if (ZSTR_LEN(tmp_value) == 2 && strcasecmp(ZSTR_VAL(tmp_value), "on") == 0) { value = 1; } else { - value = atoi(tmp_value->val); + value = atoi(ZSTR_VAL(tmp_value)); } } else { value = 0; @@ -571,9 +571,9 @@ ZEND_INI_DISP(zend_ini_color_displayer_cb) /* {{{ */ char *value; if (type == ZEND_INI_DISPLAY_ORIG && ini_entry->modified) { - value = ini_entry->orig_value->val; + value = ZSTR_VAL(ini_entry->orig_value); } else if (ini_entry->value) { - value = ini_entry->value->val; + value = ZSTR_VAL(ini_entry->value); } else { value = NULL; } @@ -598,9 +598,9 @@ ZEND_INI_DISP(display_link_numbers) /* {{{ */ char *value; if (type == ZEND_INI_DISPLAY_ORIG && ini_entry->modified) { - value = ini_entry->orig_value->val; + value = ZSTR_VAL(ini_entry->orig_value); } else if (ini_entry->value) { - value = ini_entry->value->val; + value = ZSTR_VAL(ini_entry->value); } else { value = NULL; } @@ -629,17 +629,17 @@ ZEND_API ZEND_INI_MH(OnUpdateBool) /* {{{ */ p = (zend_bool *) (base+(size_t) mh_arg1); - if (new_value->len == 2 && strcasecmp("on", new_value->val) == 0) { + if (ZSTR_LEN(new_value) == 2 && strcasecmp("on", ZSTR_VAL(new_value)) == 0) { *p = (zend_bool) 1; } - else if (new_value->len == 3 && strcasecmp("yes", new_value->val) == 0) { + else if (ZSTR_LEN(new_value) == 3 && strcasecmp("yes", ZSTR_VAL(new_value)) == 0) { *p = (zend_bool) 1; } - else if (new_value->len == 4 && strcasecmp("true", new_value->val) == 0) { + else if (ZSTR_LEN(new_value) == 4 && strcasecmp("true", ZSTR_VAL(new_value)) == 0) { *p = (zend_bool) 1; } else { - *p = (zend_bool) atoi(new_value->val); + *p = (zend_bool) atoi(ZSTR_VAL(new_value)); } return SUCCESS; } @@ -658,7 +658,7 @@ ZEND_API ZEND_INI_MH(OnUpdateLong) /* {{{ */ p = (zend_long *) (base+(size_t) mh_arg1); - *p = zend_atol(new_value->val, (int)new_value->len); + *p = zend_atol(ZSTR_VAL(new_value), (int)ZSTR_LEN(new_value)); return SUCCESS; } /* }}} */ @@ -674,7 +674,7 @@ ZEND_API ZEND_INI_MH(OnUpdateLongGEZero) /* {{{ */ base = (char *) ts_resource(*((int *) mh_arg2)); #endif - tmp = zend_atol(new_value->val, (int)new_value->len); + tmp = zend_atol(ZSTR_VAL(new_value), (int)ZSTR_LEN(new_value)); if (tmp < 0) { return FAILURE; } @@ -699,7 +699,7 @@ ZEND_API ZEND_INI_MH(OnUpdateReal) /* {{{ */ p = (double *) (base+(size_t) mh_arg1); - *p = zend_strtod(new_value->val, NULL); + *p = zend_strtod(ZSTR_VAL(new_value), NULL); return SUCCESS; } /* }}} */ @@ -717,7 +717,7 @@ ZEND_API ZEND_INI_MH(OnUpdateString) /* {{{ */ p = (char **) (base+(size_t) mh_arg1); - *p = new_value ? new_value->val : NULL; + *p = new_value ? ZSTR_VAL(new_value) : NULL; return SUCCESS; } /* }}} */ @@ -733,13 +733,13 @@ ZEND_API ZEND_INI_MH(OnUpdateStringUnempty) /* {{{ */ base = (char *) ts_resource(*((int *) mh_arg2)); #endif - if (new_value && !new_value->val[0]) { + if (new_value && !ZSTR_VAL(new_value)[0]) { return FAILURE; } p = (char **) (base+(size_t) mh_arg1); - *p = new_value ? new_value->val : NULL; + *p = new_value ? ZSTR_VAL(new_value) : NULL; return SUCCESS; } /* }}} */ diff --git a/Zend/zend_interfaces.c b/Zend/zend_interfaces.c index 3b4d2042f1..351b4da2ce 100644 --- a/Zend/zend_interfaces.c +++ b/Zend/zend_interfaces.c @@ -78,7 +78,7 @@ ZEND_API zval* zend_call_method(zval *object, zend_class_entry *obj_ce, zend_fun if (!fn_proxy || !*fn_proxy) { if ((fcic.function_handler = zend_hash_find_ptr(function_table, Z_STR(fci.function_name))) == NULL) { /* error at c-level */ - zend_error_noreturn(E_CORE_ERROR, "Couldn't find implementation for method %s%s%s", obj_ce ? obj_ce->name->val : "", obj_ce ? "::" : "", function_name); + zend_error_noreturn(E_CORE_ERROR, "Couldn't find implementation for method %s%s%s", obj_ce ? ZSTR_VAL(obj_ce->name) : "", obj_ce ? "::" : "", function_name); } if (fn_proxy) { *fn_proxy = fcic.function_handler; @@ -110,7 +110,7 @@ ZEND_API zval* zend_call_method(zval *object, zend_class_entry *obj_ce, zend_fun obj_ce = object ? Z_OBJCE_P(object) : NULL; } if (!EG(exception)) { - zend_error_noreturn(E_CORE_ERROR, "Couldn't execute method %s%s%s", obj_ce ? obj_ce->name->val : "", obj_ce ? "::" : "", function_name); + zend_error_noreturn(E_CORE_ERROR, "Couldn't execute method %s%s%s", obj_ce ? ZSTR_VAL(obj_ce->name) : "", obj_ce ? "::" : "", function_name); } } /* copy arguments back, they might be changed by references */ @@ -216,7 +216,7 @@ ZEND_API void zend_user_it_get_current_key(zend_object_iterator *_iter, zval *ke ZVAL_ZVAL(key, &retval, 1, 1); } else { if (!EG(exception)) { - zend_error(E_WARNING, "Nothing returned from %s::key()", iter->ce->name->val); + zend_error(E_WARNING, "Nothing returned from %s::key()", ZSTR_VAL(iter->ce->name)); } ZVAL_LONG(key, 0); @@ -290,7 +290,7 @@ ZEND_API zend_object_iterator *zend_user_it_get_new_iterator(zend_class_entry *c if (!ce_it || !ce_it->get_iterator || (ce_it->get_iterator == zend_user_it_get_new_iterator && Z_OBJ(iterator) == Z_OBJ_P(object))) { if (!EG(exception)) { - zend_throw_exception_ex(NULL, 0, "Objects returned by %s::getIterator() must be traversable or implement interface Iterator", ce ? ce->name->val : Z_OBJCE_P(object)->name->val); + zend_throw_exception_ex(NULL, 0, "Objects returned by %s::getIterator() must be traversable or implement interface Iterator", ce ? ZSTR_VAL(ce->name) : ZSTR_VAL(Z_OBJCE_P(object)->name)); } zval_ptr_dtor(&iterator); return NULL; @@ -317,10 +317,10 @@ static int zend_implement_traversable(zend_class_entry *interface, zend_class_en } } zend_error_noreturn(E_CORE_ERROR, "Class %s must implement interface %s as part of either %s or %s", - class_type->name->val, - zend_ce_traversable->name->val, - zend_ce_iterator->name->val, - zend_ce_aggregate->name->val); + ZSTR_VAL(class_type->name), + ZSTR_VAL(zend_ce_traversable->name), + ZSTR_VAL(zend_ce_iterator->name), + ZSTR_VAL(zend_ce_aggregate->name)); return FAILURE; } /* }}} */ @@ -341,9 +341,9 @@ static int zend_implement_aggregate(zend_class_entry *interface, zend_class_entr for (i = 0; i < class_type->num_interfaces; i++) { if (class_type->interfaces[i] == zend_ce_iterator) { zend_error_noreturn(E_ERROR, "Class %s cannot implement both %s and %s at the same time", - class_type->name->val, - interface->name->val, - zend_ce_iterator->name->val); + ZSTR_VAL(class_type->name), + ZSTR_VAL(interface->name), + ZSTR_VAL(zend_ce_iterator->name)); return FAILURE; } if (class_type->interfaces[i] == zend_ce_traversable) { @@ -373,9 +373,9 @@ static int zend_implement_iterator(zend_class_entry *interface, zend_class_entry /* c-level get_iterator cannot be changed */ if (class_type->get_iterator == zend_user_it_get_new_iterator) { zend_error_noreturn(E_ERROR, "Class %s cannot implement both %s and %s at the same time", - class_type->name->val, - interface->name->val, - zend_ce_aggregate->name->val); + ZSTR_VAL(class_type->name), + ZSTR_VAL(interface->name), + ZSTR_VAL(zend_ce_aggregate->name)); } return FAILURE; } @@ -440,7 +440,7 @@ ZEND_API int zend_user_serialize(zval *object, unsigned char **buffer, size_t *b } if (result == FAILURE && !EG(exception)) { - zend_throw_exception_ex(NULL, 0, "%s::serialize() must return a string or NULL", ce->name->val); + zend_throw_exception_ex(NULL, 0, "%s::serialize() must return a string or NULL", ZSTR_VAL(ce->name)); } return result; } @@ -472,14 +472,14 @@ ZEND_API int zend_user_unserialize(zval *object, zend_class_entry *ce, const uns ZEND_API int zend_class_serialize_deny(zval *object, unsigned char **buffer, size_t *buf_len, zend_serialize_data *data) /* {{{ */ { zend_class_entry *ce = Z_OBJCE_P(object); - zend_throw_exception_ex(NULL, 0, "Serialization of '%s' is not allowed", ce->name->val); + zend_throw_exception_ex(NULL, 0, "Serialization of '%s' is not allowed", ZSTR_VAL(ce->name)); return FAILURE; } /* }}} */ ZEND_API int zend_class_unserialize_deny(zval *object, zend_class_entry *ce, const unsigned char *buf, size_t buf_len, zend_unserialize_data *data) /* {{{ */ { - zend_throw_exception_ex(NULL, 0, "Unserialization of '%s' is not allowed", ce->name->val); + zend_throw_exception_ex(NULL, 0, "Unserialization of '%s' is not allowed", ZSTR_VAL(ce->name)); return FAILURE; } /* }}} */ diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index 61bd25c5c5..144adc25bb 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -300,9 +300,9 @@ static zend_always_inline uint32_t zend_get_property_offset(zend_class_entry *ce return (uint32_t)(intptr_t)CACHED_PTR_EX(cache_slot + 1); } - if (UNEXPECTED(member->val[0] == '\0')) { + if (UNEXPECTED(ZSTR_VAL(member)[0] == '\0')) { if (!silent) { - if (member->len == 0) { + if (ZSTR_LEN(member) == 0) { zend_error(E_EXCEPTION | E_ERROR, "Cannot access empty property"); } else { zend_error(E_EXCEPTION | E_ERROR, "Cannot access property started with '\\0'"); @@ -328,7 +328,7 @@ static zend_always_inline uint32_t zend_get_property_offset(zend_class_entry *ce || UNEXPECTED((flags & ZEND_ACC_PRIVATE))) { if (UNEXPECTED((flags & ZEND_ACC_STATIC) != 0)) { if (!silent) { - zend_error(E_NOTICE, "Accessing static property %s::$%s as non static", ce->name->val, member->val); + zend_error(E_NOTICE, "Accessing static property %s::$%s as non static", ZSTR_VAL(ce->name), ZSTR_VAL(member)); } return ZEND_DYNAMIC_PROPERTY_OFFSET; } @@ -359,7 +359,7 @@ exit_dynamic: } else if (UNEXPECTED(property_info == ZEND_WRONG_PROPERTY_INFO)) { /* Information was available, but we were denied access. Error out. */ if (!silent) { - zend_error(E_EXCEPTION | E_ERROR, "Cannot access %s property %s::$%s", zend_visibility_string(flags), ce->name->val, member->val); + zend_error(E_EXCEPTION | E_ERROR, "Cannot access %s property %s::$%s", zend_visibility_string(flags), ZSTR_VAL(ce->name), ZSTR_VAL(member)); } return ZEND_WRONG_PROPERTY_OFFSET; } @@ -378,9 +378,9 @@ ZEND_API zend_property_info *zend_get_property_info(zend_class_entry *ce, zend_s zend_property_info *property_info = NULL; uint32_t flags; - if (UNEXPECTED(member->val[0] == '\0')) { + if (UNEXPECTED(ZSTR_VAL(member)[0] == '\0')) { if (!silent) { - if (member->len == 0) { + if (ZSTR_LEN(member) == 0) { zend_error(E_EXCEPTION | E_ERROR, "Cannot access empty property"); } else { zend_error(E_EXCEPTION | E_ERROR, "Cannot access property started with '\\0'"); @@ -406,7 +406,7 @@ ZEND_API zend_property_info *zend_get_property_info(zend_class_entry *ce, zend_s || UNEXPECTED((flags & ZEND_ACC_PRIVATE))) { if (UNEXPECTED((flags & ZEND_ACC_STATIC) != 0)) { if (!silent) { - zend_error(E_NOTICE, "Accessing static property %s::$%s as non static", ce->name->val, member->val); + zend_error(E_NOTICE, "Accessing static property %s::$%s as non static", ZSTR_VAL(ce->name), ZSTR_VAL(member)); } } goto exit; @@ -430,7 +430,7 @@ exit_dynamic: } else if (UNEXPECTED(property_info == ZEND_WRONG_PROPERTY_INFO)) { /* Information was available, but we were denied access. Error out. */ if (!silent) { - zend_error(E_EXCEPTION | E_ERROR, "Cannot access %s property %s::$%s", zend_visibility_string(flags), ce->name->val, member->val); + zend_error(E_EXCEPTION | E_ERROR, "Cannot access %s property %s::$%s", zend_visibility_string(flags), ZSTR_VAL(ce->name), ZSTR_VAL(member)); } return ZEND_WRONG_PROPERTY_INFO; } @@ -448,7 +448,7 @@ ZEND_API int zend_check_property_access(zend_object *zobj, zend_string *prop_inf zend_string *member; size_t prop_name_len; - if (prop_info_name->val[0] == 0) { + if (ZSTR_VAL(prop_info_name)[0] == 0) { zend_unmangle_property_name_ex(prop_info_name, &class_name, &prop_name, &prop_name_len); member = zend_string_init(prop_name, prop_name_len, 0); } else { @@ -470,7 +470,7 @@ ZEND_API int zend_check_property_access(zend_object *zobj, zend_string *prop_inf if (!(property_info->flags & ZEND_ACC_PRIVATE)) { /* we we're looking for a private prop but found a non private one of the same name */ return FAILURE; - } else if (strcmp(prop_info_name->val+1, property_info->name->val+1)) { + } else if (strcmp(ZSTR_VAL(prop_info_name)+1, ZSTR_VAL(property_info->name)+1)) { /* we we're looking for a private prop but found a private one of the same name but another class */ return FAILURE; } @@ -566,7 +566,7 @@ zval *zend_std_read_property(zval *object, zval *member, int type, void **cache_ (type == BP_VAR_W || type == BP_VAR_RW || type == BP_VAR_UNSET)) { SEPARATE_ZVAL(rv); if (UNEXPECTED(Z_TYPE_P(rv) != IS_OBJECT)) { - zend_error(E_NOTICE, "Indirect modification of overloaded property %s::$%s has no effect", zobj->ce->name->val, Z_STRVAL_P(member)); + zend_error(E_NOTICE, "Indirect modification of overloaded property %s::$%s has no effect", ZSTR_VAL(zobj->ce->name), Z_STRVAL_P(member)); } } } else { @@ -589,7 +589,7 @@ zval *zend_std_read_property(zval *object, zval *member, int type, void **cache_ } } if ((type != BP_VAR_IS)) { - zend_error(E_NOTICE,"Undefined property: %s::$%s", zobj->ce->name->val, Z_STRVAL_P(member)); + zend_error(E_NOTICE,"Undefined property: %s::$%s", ZSTR_VAL(zobj->ce->name), Z_STRVAL_P(member)); } retval = &EG(uninitialized_zval); @@ -720,13 +720,13 @@ zval *zend_std_read_dimension(zval *object, zval *offset, int type, zval *rv) /* if (UNEXPECTED(Z_TYPE_P(rv) == IS_UNDEF)) { if (UNEXPECTED(!EG(exception))) { - zend_error(E_EXCEPTION | E_ERROR, "Undefined offset for object of type %s used as array", ce->name->val); + zend_error(E_EXCEPTION | E_ERROR, "Undefined offset for object of type %s used as array", ZSTR_VAL(ce->name)); } return NULL; } return rv; } else { - zend_error(E_EXCEPTION | E_ERROR, "Cannot use object of type %s as array", ce->name->val); + zend_error(E_EXCEPTION | E_ERROR, "Cannot use object of type %s as array", ZSTR_VAL(ce->name)); return NULL; } } @@ -747,7 +747,7 @@ static void zend_std_write_dimension(zval *object, zval *offset, zval *value) /* zend_call_method_with_2_params(object, ce, NULL, "offsetset", NULL, offset, value); zval_ptr_dtor(offset); } else { - zend_error(E_EXCEPTION | E_ERROR, "Cannot use object of type %s as array", ce->name->val); + zend_error(E_EXCEPTION | E_ERROR, "Cannot use object of type %s as array", ZSTR_VAL(ce->name)); } } /* }}} */ @@ -776,7 +776,7 @@ static int zend_std_has_dimension(zval *object, zval *offset, int check_empty) / } zval_ptr_dtor(offset); } else { - zend_error(E_EXCEPTION | E_ERROR, "Cannot use object of type %s as array", ce->name->val); + zend_error(E_EXCEPTION | E_ERROR, "Cannot use object of type %s as array", ZSTR_VAL(ce->name)); return 0; } return result; @@ -798,7 +798,7 @@ static zval *zend_std_get_property_ptr_ptr(zval *object, zval *member, int type, } #if DEBUG_OBJECT_HANDLERS - fprintf(stderr, "Ptr object #%d property: %s\n", Z_OBJ_HANDLE_P(object), name->val); + fprintf(stderr, "Ptr object #%d property: %s\n", Z_OBJ_HANDLE_P(object), ZSTR_VAL(name)); #endif property_offset = zend_get_property_offset(zobj->ce, name, (zobj->ce->__get != NULL), cache_slot); @@ -813,7 +813,7 @@ static zval *zend_std_get_property_ptr_ptr(zval *object, zval *member, int type, /* Notice is thrown after creation of the property, to avoid EG(std_property_info) * being overwritten in an error handler. */ if (UNEXPECTED(type == BP_VAR_RW || type == BP_VAR_R)) { - zend_error(E_NOTICE, "Undefined property: %s::$%s", zobj->ce->name->val, name->val); + zend_error(E_NOTICE, "Undefined property: %s::$%s", ZSTR_VAL(zobj->ce->name), ZSTR_VAL(name)); } } else { /* we do have getter - fail and let it try again with usual get/set */ @@ -844,7 +844,7 @@ static zval *zend_std_get_property_ptr_ptr(zval *object, zval *member, int type, /* Notice is thrown after creation of the property, to avoid EG(std_property_info) * being overwritten in an error handler. */ if (UNEXPECTED(type == BP_VAR_RW || type == BP_VAR_R)) { - zend_error(E_NOTICE, "Undefined property: %s::$%s", zobj->ce->name->val, name->val); + zend_error(E_NOTICE, "Undefined property: %s::$%s", ZSTR_VAL(zobj->ce->name), ZSTR_VAL(name)); } } } @@ -939,7 +939,7 @@ static void zend_std_unset_dimension(zval *object, zval *offset) /* {{{ */ zend_call_method_with_1_params(object, ce, NULL, "offsetunset", NULL, offset); zval_ptr_dtor(offset); } else { - zend_error(E_EXCEPTION | E_ERROR, "Cannot use object of type %s as array", ce->name->val); + zend_error(E_EXCEPTION | E_ERROR, "Cannot use object of type %s as array", ZSTR_VAL(ce->name)); } } /* }}} */ @@ -1054,8 +1054,8 @@ ZEND_API zend_function *zend_get_call_trampoline_func(zend_class_entry *ce, zend //??? keep compatibility for "\0" characters //??? see: Zend/tests/bug46238.phpt - if (UNEXPECTED(strlen(method_name->val) != method_name->len)) { - func->function_name = zend_string_init(method_name->val, strlen(method_name->val), 0); + if (UNEXPECTED(strlen(ZSTR_VAL(method_name)) != ZSTR_LEN(method_name))) { + func->function_name = zend_string_init(ZSTR_VAL(method_name), strlen(ZSTR_VAL(method_name)), 0); } else { func->function_name = zend_string_copy(method_name); } @@ -1084,8 +1084,8 @@ static union _zend_function *zend_std_get_method(zend_object **obj_ptr, zend_str use_heap = 0; #endif } else { - ZSTR_ALLOCA_ALLOC(lc_method_name, method_name->len, use_heap); - zend_str_tolower_copy(lc_method_name->val, method_name->val, method_name->len); + ZSTR_ALLOCA_ALLOC(lc_method_name, ZSTR_LEN(method_name), use_heap); + zend_str_tolower_copy(ZSTR_VAL(lc_method_name), ZSTR_VAL(method_name), ZSTR_LEN(method_name)); } if (UNEXPECTED((func = zend_hash_find(&zobj->ce->function_table, lc_method_name)) == NULL)) { @@ -1114,7 +1114,7 @@ static union _zend_function *zend_std_get_method(zend_object **obj_ptr, zend_str if (zobj->ce->__call) { fbc = zend_get_user_call_function(zobj->ce, method_name); } else { - zend_error(E_EXCEPTION | E_ERROR, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), method_name->val, EG(scope) ? EG(scope)->name->val : ""); + zend_error(E_EXCEPTION | E_ERROR, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), ZSTR_VAL(method_name), EG(scope) ? ZSTR_VAL(EG(scope)->name) : ""); fbc = NULL; } } @@ -1141,7 +1141,7 @@ static union _zend_function *zend_std_get_method(zend_object **obj_ptr, zend_str if (zobj->ce->__call) { fbc = zend_get_user_call_function(zobj->ce, method_name); } else { - zend_error(E_EXCEPTION | E_ERROR, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), method_name->val, EG(scope) ? EG(scope)->name->val : ""); + zend_error(E_EXCEPTION | E_ERROR, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), ZSTR_VAL(method_name), EG(scope) ? ZSTR_VAL(EG(scope)->name) : ""); fbc = NULL; } } @@ -1174,12 +1174,12 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, zend_st lc_function_name = zend_string_tolower(function_name); } - if (function_name->len == ce->name->len && ce->constructor) { - lc_class_name = zend_str_tolower_dup(ce->name->val, ce->name->len); + if (ZSTR_LEN(function_name) == ZSTR_LEN(ce->name) && ce->constructor) { + lc_class_name = zend_str_tolower_dup(ZSTR_VAL(ce->name), ZSTR_LEN(ce->name)); /* Only change the method to the constructor if the constructor isn't called __construct * we check for __ so we can be binary safe for lowering, we should use ZEND_CONSTRUCTOR_FUNC_NAME */ - if (!memcmp(lc_class_name, lc_function_name->val, function_name->len) && memcmp(ce->constructor->common.function_name->val, "__", sizeof("__") - 1)) { + if (!memcmp(lc_class_name, ZSTR_VAL(lc_function_name), ZSTR_LEN(function_name)) && memcmp(ZSTR_VAL(ce->constructor->common.function_name), "__", sizeof("__") - 1)) { fbc = ce->constructor; } efree(lc_class_name); @@ -1217,7 +1217,7 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, zend_st /* right now this function is used for non static method lookup too */ /* Is the function static */ if (UNEXPECTED(!(fbc->common.fn_flags & ZEND_ACC_STATIC))) { - zend_error_noreturn(E_ERROR, "Cannot call non static method %s::%s() without object", ZEND_FN_SCOPE_NAME(fbc), fbc->common.function_name->val); + zend_error_noreturn(E_ERROR, "Cannot call non static method %s::%s() without object", ZEND_FN_SCOPE_NAME(fbc), ZSTR_VAL(fbc->common.function_name)); } #endif if (fbc->op_array.fn_flags & ZEND_ACC_PUBLIC) { @@ -1234,7 +1234,7 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, zend_st if (ce->__callstatic) { fbc = zend_get_user_callstatic_function(ce, function_name); } else { - zend_error(E_EXCEPTION | E_ERROR, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), function_name->val, EG(scope) ? EG(scope)->name->val : ""); + zend_error(E_EXCEPTION | E_ERROR, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), ZSTR_VAL(function_name), EG(scope) ? ZSTR_VAL(EG(scope)->name) : ""); fbc = NULL; } } @@ -1245,7 +1245,7 @@ ZEND_API zend_function *zend_std_get_static_method(zend_class_entry *ce, zend_st if (ce->__callstatic) { fbc = zend_get_user_callstatic_function(ce, function_name); } else { - zend_error(E_EXCEPTION | E_ERROR, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), function_name->val, EG(scope) ? EG(scope)->name->val : ""); + zend_error(E_EXCEPTION | E_ERROR, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), ZSTR_VAL(function_name), EG(scope) ? ZSTR_VAL(EG(scope)->name) : ""); fbc = NULL; } } @@ -1270,7 +1270,7 @@ ZEND_API zval *zend_std_get_static_property(zend_class_entry *ce, zend_string *p if (UNEXPECTED(!zend_verify_property_access(property_info, ce))) { if (!silent) { - zend_error(E_EXCEPTION | E_ERROR, "Cannot access %s property %s::$%s", zend_visibility_string(property_info->flags), ce->name->val, property_name->val); + zend_error(E_EXCEPTION | E_ERROR, "Cannot access %s property %s::$%s", zend_visibility_string(property_info->flags), ZSTR_VAL(ce->name), ZSTR_VAL(property_name)); } return NULL; } @@ -1290,7 +1290,7 @@ ZEND_API zval *zend_std_get_static_property(zend_class_entry *ce, zend_string *p if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) { undeclared_property: if (!silent) { - zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ce->name->val, property_name->val); + zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(property_name)); } ret = NULL; } @@ -1301,7 +1301,7 @@ undeclared_property: ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, zend_string *property_name) /* {{{ */ { - zend_error(E_EXCEPTION | E_ERROR, "Attempt to unset static property %s::$%s", ce->name->val, property_name->val); + zend_error(E_EXCEPTION | E_ERROR, "Attempt to unset static property %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(property_name)); return 0; } /* }}} */ @@ -1318,10 +1318,10 @@ ZEND_API union _zend_function *zend_std_get_constructor(zend_object *zobj) /* {{ */ if (UNEXPECTED(constructor->common.scope != EG(scope))) { if (EG(scope)) { - zend_error(E_EXCEPTION | E_ERROR, "Call to private %s::%s() from context '%s'", constructor->common.scope->name->val, constructor->common.function_name->val, EG(scope)->name->val); + zend_error(E_EXCEPTION | E_ERROR, "Call to private %s::%s() from context '%s'", ZSTR_VAL(constructor->common.scope->name), ZSTR_VAL(constructor->common.function_name), ZSTR_VAL(EG(scope)->name)); constructor = NULL; } else { - zend_error(E_EXCEPTION | E_ERROR, "Call to private %s::%s() from invalid context", constructor->common.scope->name->val, constructor->common.function_name->val); + zend_error(E_EXCEPTION | E_ERROR, "Call to private %s::%s() from invalid context", ZSTR_VAL(constructor->common.scope->name), ZSTR_VAL(constructor->common.function_name)); constructor = NULL; } } @@ -1332,10 +1332,10 @@ ZEND_API union _zend_function *zend_std_get_constructor(zend_object *zobj) /* {{ */ if (UNEXPECTED(!zend_check_protected(zend_get_function_root_class(constructor), EG(scope)))) { if (EG(scope)) { - zend_error(E_EXCEPTION | E_ERROR, "Call to protected %s::%s() from context '%s'", constructor->common.scope->name->val, constructor->common.function_name->val, EG(scope)->name->val); + zend_error(E_EXCEPTION | E_ERROR, "Call to protected %s::%s() from context '%s'", ZSTR_VAL(constructor->common.scope->name), ZSTR_VAL(constructor->common.function_name), ZSTR_VAL(EG(scope)->name)); constructor = NULL; } else { - zend_error(E_EXCEPTION | E_ERROR, "Call to protected %s::%s() from invalid context", constructor->common.scope->name->val, constructor->common.function_name->val); + zend_error(E_EXCEPTION | E_ERROR, "Call to protected %s::%s() from invalid context", ZSTR_VAL(constructor->common.scope->name), ZSTR_VAL(constructor->common.function_name)); constructor = NULL; } } @@ -1522,7 +1522,7 @@ ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int ty if (UNEXPECTED(EG(exception) != NULL)) { zval_ptr_dtor(&retval); EG(exception) = NULL; - zend_error_noreturn(E_ERROR, "Method %s::__toString() must not throw an exception", ce->name->val); + zend_error_noreturn(E_ERROR, "Method %s::__toString() must not throw an exception", ZSTR_VAL(ce->name)); return FAILURE; } if (EXPECTED(Z_TYPE(retval) == IS_STRING)) { @@ -1537,7 +1537,7 @@ ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int ty zval_ptr_dtor(readobj); } ZVAL_EMPTY_STRING(writeobj); - zend_error(E_RECOVERABLE_ERROR, "Method %s::__toString() must return a string value", ce->name->val); + zend_error(E_RECOVERABLE_ERROR, "Method %s::__toString() must return a string value", ZSTR_VAL(ce->name)); return SUCCESS; } } @@ -1547,7 +1547,7 @@ ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int ty return SUCCESS; case IS_LONG: ce = Z_OBJCE_P(readobj); - zend_error(E_NOTICE, "Object of class %s could not be converted to int", ce->name->val); + zend_error(E_NOTICE, "Object of class %s could not be converted to int", ZSTR_VAL(ce->name)); if (readobj == writeobj) { zval_dtor(readobj); } @@ -1555,7 +1555,7 @@ ZEND_API int zend_std_cast_object_tostring(zval *readobj, zval *writeobj, int ty return SUCCESS; case IS_DOUBLE: ce = Z_OBJCE_P(readobj); - zend_error(E_NOTICE, "Object of class %s could not be converted to float", ce->name->val); + zend_error(E_NOTICE, "Object of class %s could not be converted to float", ZSTR_VAL(ce->name)); if (readobj == writeobj) { zval_dtor(readobj); } diff --git a/Zend/zend_objects.c b/Zend/zend_objects.c index 91bb603de4..9eccf1b601 100644 --- a/Zend/zend_objects.c +++ b/Zend/zend_objects.c @@ -97,8 +97,8 @@ ZEND_API void zend_objects_destroy_object(zend_object *object) zend_error(EG(current_execute_data) ? E_EXCEPTION | E_ERROR : E_WARNING, "Call to private %s::__destruct() from context '%s'%s", - ce->name->val, - EG(scope) ? EG(scope)->name->val : "", + ZSTR_VAL(ce->name), + EG(scope) ? ZSTR_VAL(EG(scope)->name) : "", EG(current_execute_data) ? "" : " during shutdown ignored"); return; } @@ -110,8 +110,8 @@ ZEND_API void zend_objects_destroy_object(zend_object *object) zend_error(EG(current_execute_data) ? E_EXCEPTION | E_ERROR : E_WARNING, "Call to protected %s::__destruct() from context '%s'%s", - ce->name->val, - EG(scope) ? EG(scope)->name->val : "", + ZSTR_VAL(ce->name), + EG(scope) ? ZSTR_VAL(EG(scope)->name) : "", EG(current_execute_data) ? "" : " during shutdown ignored"); return; } diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c index 1c760c5902..a971a5e900 100644 --- a/Zend/zend_opcode.c +++ b/Zend/zend_opcode.c @@ -842,9 +842,9 @@ int pass_two_wrapper(zval *el) int print_class(zend_class_entry *class_entry) { - printf("Class %s:\n", class_entry->name->val); + printf("Class %s:\n", ZSTR_VAL(class_entry->name)); zend_hash_apply(&class_entry->function_table, pass_two_wrapper); - printf("End of class %s.\n\n", class_entry->name->val); + printf("End of class %s.\n\n", ZSTR_VAL(class_entry->name)); return 0; } diff --git a/Zend/zend_operators.c b/Zend/zend_operators.c index 8ceca62500..1abfcca7a5 100644 --- a/Zend/zend_operators.c +++ b/Zend/zend_operators.c @@ -158,7 +158,7 @@ try_again: zend_string *str; str = Z_STR_P(op); - if ((Z_TYPE_INFO_P(op)=is_numeric_string(str->val, str->len, &Z_LVAL_P(op), &Z_DVAL_P(op), 1)) == 0) { + if ((Z_TYPE_INFO_P(op)=is_numeric_string(ZSTR_VAL(str), ZSTR_LEN(str), &Z_LVAL_P(op), &Z_DVAL_P(op), 1)) == 0) { ZVAL_LONG(op, 0); } zend_string_release(str); @@ -232,7 +232,7 @@ try_again: if (Z_OBJ_HT_P(op)->cast_object) { \ if (Z_OBJ_HT_P(op)->cast_object(op, dst, ctype) == FAILURE) { \ zend_error(E_RECOVERABLE_ERROR, \ - "Object of class %s could not be converted to %s", Z_OBJCE_P(op)->name->val,\ + "Object of class %s could not be converted to %s", ZSTR_VAL(Z_OBJCE_P(op)->name),\ zend_get_type_by_const(ctype)); \ } \ } else if (Z_OBJ_HT_P(op)->get) { \ @@ -313,7 +313,7 @@ try_again: { zend_string *str = Z_STR_P(op); - ZVAL_LONG(op, ZEND_STRTOL(str->val, NULL, base)); + ZVAL_LONG(op, ZEND_STRTOL(ZSTR_VAL(str), NULL, base)); zend_string_release(str); } break; @@ -373,7 +373,7 @@ try_again: { zend_string *str = Z_STR_P(op); - ZVAL_DOUBLE(op, zend_strtod(str->val, NULL)); + ZVAL_DOUBLE(op, zend_strtod(ZSTR_VAL(str), NULL)); zend_string_release(str); } break; @@ -453,8 +453,8 @@ try_again: { zend_string *str = Z_STR_P(op); - if (str->len == 0 - || (str->len == 1 && str->val[0] == '0')) { + if (ZSTR_LEN(str) == 0 + || (ZSTR_LEN(str) == 1 && ZSTR_VAL(str)[0] == '0')) { ZVAL_FALSE(op); } else { ZVAL_TRUE(op); @@ -829,7 +829,7 @@ try_again: } zval_ptr_dtor(z); } - zend_error(EG(exception) ? E_ERROR : E_RECOVERABLE_ERROR, "Object of class %s could not be converted to string", Z_OBJCE_P(op)->name->val); + zend_error(EG(exception) ? E_ERROR : E_RECOVERABLE_ERROR, "Object of class %s could not be converted to string", ZSTR_VAL(Z_OBJCE_P(op)->name)); return ZSTR_EMPTY_ALLOC(); } case IS_REFERENCE: @@ -1344,9 +1344,9 @@ ZEND_API int ZEND_FASTCALL bitwise_or_function(zval *result, zval *op1, zval *op str = zend_string_alloc(Z_STRLEN_P(longer), 0); for (i = 0; i < Z_STRLEN_P(shorter); i++) { - str->val[i] = Z_STRVAL_P(longer)[i] | Z_STRVAL_P(shorter)[i]; + ZSTR_VAL(str)[i] = Z_STRVAL_P(longer)[i] | Z_STRVAL_P(shorter)[i]; } - memcpy(str->val + i, Z_STRVAL_P(longer) + i, Z_STRLEN_P(longer) - i + 1); + memcpy(ZSTR_VAL(str) + i, Z_STRVAL_P(longer) + i, Z_STRLEN_P(longer) - i + 1); if (result==op1) { zend_string_release(Z_STR_P(result)); } @@ -1411,9 +1411,9 @@ ZEND_API int ZEND_FASTCALL bitwise_and_function(zval *result, zval *op1, zval *o str = zend_string_alloc(Z_STRLEN_P(shorter), 0); for (i = 0; i < Z_STRLEN_P(shorter); i++) { - str->val[i] = Z_STRVAL_P(shorter)[i] & Z_STRVAL_P(longer)[i]; + ZSTR_VAL(str)[i] = Z_STRVAL_P(shorter)[i] & Z_STRVAL_P(longer)[i]; } - str->val[i] = 0; + ZSTR_VAL(str)[i] = 0; if (result==op1) { zend_string_release(Z_STR_P(result)); } @@ -1478,9 +1478,9 @@ ZEND_API int ZEND_FASTCALL bitwise_xor_function(zval *result, zval *op1, zval *o str = zend_string_alloc(Z_STRLEN_P(shorter), 0); for (i = 0; i < Z_STRLEN_P(shorter); i++) { - str->val[i] = Z_STRVAL_P(shorter)[i] ^ Z_STRVAL_P(longer)[i]; + ZSTR_VAL(str)[i] = Z_STRVAL_P(shorter)[i] ^ Z_STRVAL_P(longer)[i]; } - str->val[i] = 0; + ZSTR_VAL(str)[i] = 0; if (result==op1) { zend_string_release(Z_STR_P(result)); } @@ -1629,7 +1629,7 @@ ZEND_API int ZEND_FASTCALL concat_function(zval *result, zval *op1, zval *op2) / result_str = zend_string_extend(Z_STR_P(result), result_len, 0); } else { result_str = zend_string_alloc(result_len, 0); - memcpy(result_str->val, Z_STRVAL_P(op1), op1_len); + memcpy(ZSTR_VAL(result_str), Z_STRVAL_P(op1), op1_len); } /* This has to happen first to account for the cases where result == op1 == op2 and @@ -1637,8 +1637,8 @@ ZEND_API int ZEND_FASTCALL concat_function(zval *result, zval *op1, zval *op2) / * point to the new string. The first op2_len bytes of result will still be the same. */ ZVAL_NEW_STR(result, result_str); - memcpy(result_str->val + op1_len, Z_STRVAL_P(op2), op2_len); - result_str->val[result_len] = '\0'; + memcpy(ZSTR_VAL(result_str) + op1_len, Z_STRVAL_P(op2), op2_len); + ZSTR_VAL(result_str)[result_len] = '\0'; } if (UNEXPECTED(use_copy1)) { @@ -1657,9 +1657,9 @@ ZEND_API int string_compare_function_ex(zval *result, zval *op1, zval *op2, zend zend_string *str2 = zval_get_string(op2); if (case_insensitive) { - ZVAL_LONG(result, zend_binary_strcasecmp_l(str1->val, str1->len, str2->val, str1->len)); + ZVAL_LONG(result, zend_binary_strcasecmp_l(ZSTR_VAL(str1), ZSTR_LEN(str1), ZSTR_VAL(str2), ZSTR_LEN(str1))); } else { - ZVAL_LONG(result, zend_binary_strcmp(str1->val, str1->len, str2->val, str2->len)); + ZVAL_LONG(result, zend_binary_strcmp(ZSTR_VAL(str1), ZSTR_LEN(str1), ZSTR_VAL(str2), ZSTR_LEN(str2))); } zend_string_release(str1); @@ -1681,7 +1681,7 @@ ZEND_API int string_compare_function(zval *result, zval *op1, zval *op2) /* {{{ zend_string *str1 = zval_get_string(op1); zend_string *str2 = zval_get_string(op2); - ZVAL_LONG(result, zend_binary_strcmp(str1->val, str1->len, str2->val, str2->len)); + ZVAL_LONG(result, zend_binary_strcmp(ZSTR_VAL(str1), ZSTR_LEN(str1), ZSTR_VAL(str2), ZSTR_LEN(str2))); zend_string_release(str1); zend_string_release(str2); @@ -1703,7 +1703,7 @@ ZEND_API int string_case_compare_function(zval *result, zval *op1, zval *op2) /* zend_string *str1 = zval_get_string(op1); zend_string *str2 = zval_get_string(op2); - ZVAL_LONG(result, zend_binary_strcasecmp_l(str1->val, str1->len, str2->val, str1->len)); + ZVAL_LONG(result, zend_binary_strcasecmp_l(ZSTR_VAL(str1), ZSTR_LEN(str1), ZSTR_VAL(str2), ZSTR_LEN(str1))); zend_string_release(str1); zend_string_release(str2); @@ -1718,7 +1718,7 @@ ZEND_API int string_locale_compare_function(zval *result, zval *op1, zval *op2) zend_string *str1 = zval_get_string(op1); zend_string *str2 = zval_get_string(op2); - ZVAL_LONG(result, strcoll(str1->val, str2->val)); + ZVAL_LONG(result, strcoll(ZSTR_VAL(str1), ZSTR_VAL(str2))); zend_string_release(str1); zend_string_release(str2); @@ -2186,17 +2186,17 @@ static void ZEND_FASTCALL increment_string(zval *str) /* {{{ */ if (carry) { t = zend_string_alloc(Z_STRLEN_P(str)+1, 0); - memcpy(t->val + 1, Z_STRVAL_P(str), Z_STRLEN_P(str)); - t->val[Z_STRLEN_P(str) + 1] = '\0'; + memcpy(ZSTR_VAL(t) + 1, Z_STRVAL_P(str), Z_STRLEN_P(str)); + ZSTR_VAL(t)[Z_STRLEN_P(str) + 1] = '\0'; switch (last) { case NUMERIC: - t->val[0] = '1'; + ZSTR_VAL(t)[0] = '1'; break; case UPPER_CASE: - t->val[0] = 'A'; + ZSTR_VAL(t)[0] = 'A'; break; case LOWER_CASE: - t->val[0] = 'a'; + ZSTR_VAL(t)[0] = 'a'; break; } zend_string_free(Z_STR_P(str)); @@ -2359,7 +2359,7 @@ ZEND_API int ZEND_FASTCALL zend_object_is_true(zval *op) /* {{{ */ if (Z_OBJ_HT_P(op)->cast_object(op, &tmp, _IS_BOOL) == SUCCESS) { return Z_TYPE(tmp) == IS_TRUE; } - zend_error(E_RECOVERABLE_ERROR, "Object of class %s could not be converted to boolean", Z_OBJ_P(op)->ce->name->val); + zend_error(E_RECOVERABLE_ERROR, "Object of class %s could not be converted to boolean", ZSTR_VAL(Z_OBJ_P(op)->ce->name)); } else if (Z_OBJ_HT_P(op)->get) { int result; zval rv; @@ -2419,18 +2419,18 @@ ZEND_API void ZEND_FASTCALL zend_str_tolower(char *str, size_t length) /* {{{ */ ZEND_API zend_string* ZEND_FASTCALL zend_string_tolower(zend_string *str) /* {{{ */ { - register unsigned char *p = (unsigned char*)str->val; - register unsigned char *end = p + str->len; + register unsigned char *p = (unsigned char*)ZSTR_VAL(str); + register unsigned char *end = p + ZSTR_LEN(str); while (p < end) { if (*p != zend_tolower_ascii(*p)) { - zend_string *res = zend_string_alloc(str->len, 0); + zend_string *res = zend_string_alloc(ZSTR_LEN(str), 0); register unsigned char *r; - if (p != (unsigned char*)str->val) { - memcpy(res->val, str->val, p - (unsigned char*)str->val); + if (p != (unsigned char*)ZSTR_VAL(str)) { + memcpy(ZSTR_VAL(res), ZSTR_VAL(str), p - (unsigned char*)ZSTR_VAL(str)); } - r = p + (res->val - str->val); + r = p + (ZSTR_VAL(res) - ZSTR_VAL(str)); while (p < end) { *r = zend_tolower_ascii(*p); p++; @@ -2693,7 +2693,7 @@ ZEND_API zend_string* ZEND_FASTCALL zend_long_to_str(zend_long num) /* {{{ */ /* }}} */ ZEND_API zend_uchar ZEND_FASTCALL is_numeric_str_function(const zend_string *str, zend_long *lval, double *dval) /* {{{ */ { - return is_numeric_string_ex(str->val, str->len, lval, dval, -1, NULL); + return is_numeric_string_ex(ZSTR_VAL(str), ZSTR_LEN(str), lval, dval, -1, NULL); } /* }}} */ diff --git a/Zend/zend_smart_str.c b/Zend/zend_smart_str.c index 44b74a7489..1d90c83060 100644 --- a/Zend/zend_smart_str.c +++ b/Zend/zend_smart_str.c @@ -39,10 +39,10 @@ ZEND_API void ZEND_FASTCALL smart_str_erealloc(smart_str *str, size_t len) ? SMART_STR_START_SIZE : SMART_STR_NEW_SIZE(len); str->s = zend_string_alloc(str->a, 0); - str->s->len = 0; + ZSTR_LEN(str->s) = 0; } else { str->a = SMART_STR_NEW_SIZE(len); - str->s = (zend_string *) erealloc2(str->s, _ZSTR_HEADER_SIZE + str->a + 1, _ZSTR_HEADER_SIZE + str->s->len + 1); + str->s = (zend_string *) erealloc2(str->s, _ZSTR_HEADER_SIZE + str->a + 1, _ZSTR_HEADER_SIZE + ZSTR_LEN(str->s) + 1); } } @@ -53,7 +53,7 @@ ZEND_API void ZEND_FASTCALL smart_str_realloc(smart_str *str, size_t len) ? SMART_STR_START_SIZE : SMART_STR_NEW_SIZE(len); str->s = zend_string_alloc(str->a, 1); - str->s->len = 0; + ZSTR_LEN(str->s) = 0; } else { str->a = SMART_STR_NEW_SIZE(len); str->s = (zend_string *) realloc(str->s, _ZSTR_HEADER_SIZE + str->a + 1); diff --git a/Zend/zend_string.c b/Zend/zend_string.c index 3fde993bfe..40378a576e 100644 --- a/Zend/zend_string.c +++ b/Zend/zend_string.c @@ -56,7 +56,7 @@ void zend_interned_strings_init(void) /* interned empty string */ str = zend_string_alloc(sizeof("")-1, 1); - str->val[0] = '\000'; + ZSTR_VAL(str)[0] = '\000'; CG(empty_string) = zend_new_interned_string_int(str); #endif @@ -92,8 +92,8 @@ static zend_string *zend_new_interned_string_int(zend_string *str) idx = HT_HASH(&CG(interned_strings), nIndex); while (idx != HT_INVALID_IDX) { p = HT_HASH_TO_BUCKET(&CG(interned_strings), idx); - if ((p->h == h) && (p->key->len == str->len)) { - if (!memcmp(p->key->val, str->val, str->len)) { + if ((p->h == h) && (ZSTR_LEN(p->key) == ZSTR_LEN(str))) { + if (!memcmp(ZSTR_VAL(p->key), ZSTR_VAL(str), ZSTR_LEN(str))) { zend_string_release(str); return p->key; } diff --git a/Zend/zend_variables.c b/Zend/zend_variables.c index 36d532e098..58e1190fc1 100644 --- a/Zend/zend_variables.c +++ b/Zend/zend_variables.c @@ -294,14 +294,14 @@ ZEND_API int zval_copy_static_var(zval *p, int num_args, va_list args, zend_hash zend_hash_add_new(symbol_table, key->key, &tmp); Z_ADDREF_P(p); } else { - zend_error(E_NOTICE,"Undefined variable: %s", key->key->val); + zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(key->key)); } } else { if (Z_TYPE_P(p) == IS_INDIRECT) { p = Z_INDIRECT_P(p); if (Z_TYPE_P(p) == IS_UNDEF) { if (!is_ref) { - zend_error(E_NOTICE,"Undefined variable: %s", key->key->val); + zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(key->key)); p = &tmp; ZVAL_NULL(&tmp); } else { diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 7c7948e132..66398e5bfa 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -265,14 +265,14 @@ ZEND_VM_HANDLER(8, ZEND_CONCAT, CONST|TMPVAR|CV, CONST|TMPVAR|CV) zend_string *str; if (OP1_TYPE != IS_CONST) { - if (UNEXPECTED(op1_str->len == 0)) { + if (UNEXPECTED(ZSTR_LEN(op1_str) == 0)) { ZVAL_STR_COPY(EX_VAR(opline->result.var), op2_str); FREE_OP1(); break; } } if (OP2_TYPE != IS_CONST) { - if (UNEXPECTED(op2_str->len == 0)) { + if (UNEXPECTED(ZSTR_LEN(op2_str) == 0)) { ZVAL_STR_COPY(EX_VAR(opline->result.var), op1_str); FREE_OP1(); break; @@ -280,16 +280,16 @@ ZEND_VM_HANDLER(8, ZEND_CONCAT, CONST|TMPVAR|CV, CONST|TMPVAR|CV) } if (OP1_TYPE != IS_CONST && OP1_TYPE != IS_CV && !ZSTR_IS_INTERNED(op1_str) && GC_REFCOUNT(op1_str) == 1) { - size_t len = op1_str->len; + size_t len = ZSTR_LEN(op1_str); - str = zend_string_realloc(op1_str, len + op2_str->len, 0); - memcpy(str->val + len, op2_str->val, op2_str->len+1); + str = zend_string_realloc(op1_str, len + ZSTR_LEN(op2_str), 0); + memcpy(ZSTR_VAL(str) + len, ZSTR_VAL(op2_str), ZSTR_LEN(op2_str)+1); ZVAL_NEW_STR(EX_VAR(opline->result.var), str); break; } else { - str = zend_string_alloc(op1_str->len + op2_str->len, 0); - memcpy(str->val, op1_str->val, op1_str->len); - memcpy(str->val + op1_str->len, op2_str->val, op2_str->len+1); + str = zend_string_alloc(ZSTR_LEN(op1_str) + ZSTR_LEN(op2_str), 0); + memcpy(ZSTR_VAL(str), ZSTR_VAL(op1_str), ZSTR_LEN(op1_str)); + memcpy(ZSTR_VAL(str) + ZSTR_LEN(op1_str), ZSTR_VAL(op2_str), ZSTR_LEN(op2_str)+1); ZVAL_NEW_STR(EX_VAR(opline->result.var), str); } } else { @@ -1452,14 +1452,14 @@ ZEND_VM_HANDLER(40, ZEND_ECHO, CONST|TMPVAR|CV, ANY) if (Z_TYPE_P(z) == IS_STRING) { zend_string *str = Z_STR_P(z); - if (str->len != 0) { - zend_write(str->val, str->len); + if (ZSTR_LEN(str) != 0) { + zend_write(ZSTR_VAL(str), ZSTR_LEN(str)); } } else { zend_string *str = _zval_get_string_func(z); - if (str->len != 0) { - zend_write(str->val, str->len); + if (ZSTR_LEN(str) != 0) { + zend_write(ZSTR_VAL(str), ZSTR_LEN(str)); } else if (OP1_TYPE == IS_CV && UNEXPECTED(Z_TYPE_P(z) == IS_UNDEF)) { GET_OP1_UNDEF_CV(z, BP_VAR_R); } @@ -1506,7 +1506,7 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMPVAR|CV, UNUSED|CONST|V /* check if static properties were destoyed */ if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) { - zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ce->name->val, name->val); + zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name)); FREE_OP1(); HANDLE_EXCEPTION(); } @@ -1533,7 +1533,7 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMPVAR|CV, UNUSED|CONST|V /* check if static properties were destoyed */ if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) { - zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ce->name->val, name->val); + zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name)); FREE_OP1(); HANDLE_EXCEPTION(); } @@ -1558,13 +1558,13 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMPVAR|CV, UNUSED|CONST|V switch (type) { case BP_VAR_R: case BP_VAR_UNSET: - zend_error(E_NOTICE,"Undefined variable: %s", name->val); + zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name)); /* break missing intentionally */ case BP_VAR_IS: retval = &EG(uninitialized_zval); break; case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined variable: %s", name->val); + zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name)); /* break missing intentionally */ case BP_VAR_W: retval = zend_hash_add_new(target_symbol_table, name, &EG(uninitialized_zval)); @@ -1578,13 +1578,13 @@ ZEND_VM_HELPER_EX(zend_fetch_var_address_helper, CONST|TMPVAR|CV, UNUSED|CONST|V switch (type) { case BP_VAR_R: case BP_VAR_UNSET: - zend_error(E_NOTICE,"Undefined variable: %s", name->val); + zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name)); /* break missing intentionally */ case BP_VAR_IS: retval = &EG(uninitialized_zval); break; case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined variable: %s", name->val); + zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name)); /* break missing intentionally */ case BP_VAR_W: ZVAL_NULL(retval); @@ -2728,7 +2728,7 @@ ZEND_VM_HANDLER(53, ZEND_FAST_CONCAT, CONST|TMPVAR|CV, CONST|TMPVAR|CV) } do { if (OP1_TYPE != IS_CONST) { - if (UNEXPECTED(op1_str->len == 0)) { + if (UNEXPECTED(ZSTR_LEN(op1_str) == 0)) { if (OP2_TYPE == IS_CONST) { zend_string_addref(op2_str); } @@ -2738,7 +2738,7 @@ ZEND_VM_HANDLER(53, ZEND_FAST_CONCAT, CONST|TMPVAR|CV, CONST|TMPVAR|CV) } } if (OP2_TYPE != IS_CONST) { - if (UNEXPECTED(op2_str->len == 0)) { + if (UNEXPECTED(ZSTR_LEN(op2_str) == 0)) { if (OP1_TYPE == IS_CONST) { zend_string_addref(op1_str); } @@ -2747,9 +2747,9 @@ ZEND_VM_HANDLER(53, ZEND_FAST_CONCAT, CONST|TMPVAR|CV, CONST|TMPVAR|CV) break; } } - str = zend_string_alloc(op1_str->len + op2_str->len, 0); - memcpy(str->val, op1_str->val, op1_str->len); - memcpy(str->val + op1_str->len, op2_str->val, op2_str->len+1); + str = zend_string_alloc(ZSTR_LEN(op1_str) + ZSTR_LEN(op2_str), 0); + memcpy(ZSTR_VAL(str), ZSTR_VAL(op1_str), ZSTR_LEN(op1_str)); + memcpy(ZSTR_VAL(str) + ZSTR_LEN(op1_str), ZSTR_VAL(op2_str), ZSTR_LEN(op2_str)+1); ZVAL_NEW_STR(EX_VAR(opline->result.var), str); if (OP1_TYPE != IS_CONST) { zend_string_release(op1_str); @@ -3012,7 +3012,7 @@ ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, CONST|TMPVAR|UNUSED|CV, CONST|TMPVAR fbc = obj->handlers->get_method(&obj, Z_STR_P(function_name), ((OP2_TYPE == IS_CONST) ? (EX_CONSTANT(opline->op2) + 1) : NULL)); if (UNEXPECTED(fbc == NULL)) { if (EXPECTED(!EG(exception))) { - zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", obj->ce->name->val, Z_STRVAL_P(function_name)); + zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(obj->ce->name), Z_STRVAL_P(function_name)); } FREE_OP2(); FREE_OP1(); @@ -3110,7 +3110,7 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMPVAR|UNUSE } if (UNEXPECTED(fbc == NULL)) { if (EXPECTED(!EG(exception))) { - zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ce->name->val, Z_STRVAL_P(function_name)); + zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(ce->name), Z_STRVAL_P(function_name)); } FREE_OP2(); HANDLE_EXCEPTION(); @@ -3133,7 +3133,7 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMPVAR|UNUSE HANDLE_EXCEPTION(); } if (Z_OBJ(EX(This)) && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) { - zend_error(E_EXCEPTION | E_ERROR, "Cannot call private %s::__construct()", ce->name->val); + zend_error(E_EXCEPTION | E_ERROR, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name)); HANDLE_EXCEPTION(); } fbc = ce->constructor; @@ -3150,14 +3150,14 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMPVAR|UNUSE zend_error( E_DEPRECATED, "Non-static method %s::%s() should not be called statically", - fbc->common.scope->name->val, fbc->common.function_name->val); + ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name)); } else { /* An internal function assumes $this is present and won't check that. * So PHP would crash by allowing the call. */ zend_error( E_EXCEPTION | E_ERROR, "Non-static method %s::%s() cannot be called statically", - fbc->common.scope->name->val, fbc->common.function_name->val); + ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name)); HANDLE_EXCEPTION(); } } @@ -3254,7 +3254,7 @@ ZEND_VM_C_LABEL(try_function_name): } if (UNEXPECTED(fbc == NULL)) { if (EXPECTED(!EG(exception))) { - zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", called_scope->name->val, mname->val); + zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(called_scope->name), ZSTR_VAL(mname)); } zend_string_release(lcname); zend_string_release(mname); @@ -3269,12 +3269,12 @@ ZEND_VM_C_LABEL(try_function_name): if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically", - fbc->common.scope->name->val, fbc->common.function_name->val); + ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name)); } else { zend_error( E_EXCEPTION | E_ERROR, "Non-static method %s::%s() cannot be called statically", - fbc->common.scope->name->val, fbc->common.function_name->val); + ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name)); FREE_OP2(); HANDLE_EXCEPTION(); } @@ -3282,7 +3282,7 @@ ZEND_VM_C_LABEL(try_function_name): } else { if (Z_STRVAL_P(function_name)[0] == '\\') { lcname = zend_string_alloc(Z_STRLEN_P(function_name) - 1, 0); - zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name) + 1, Z_STRLEN_P(function_name) - 1); + zend_str_tolower_copy(ZSTR_VAL(lcname), Z_STRVAL_P(function_name) + 1, Z_STRLEN_P(function_name) - 1); } else { lcname = zend_string_tolower(Z_STR_P(function_name)); } @@ -3352,7 +3352,7 @@ ZEND_VM_C_LABEL(try_function_name): } if (UNEXPECTED(fbc == NULL)) { if (EXPECTED(!EG(exception))) { - zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", called_scope->name->val, Z_STRVAL_P(method)); + zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(called_scope->name), Z_STRVAL_P(method)); } FREE_OP2(); HANDLE_EXCEPTION(); @@ -3361,12 +3361,12 @@ ZEND_VM_C_LABEL(try_function_name): if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically", - fbc->common.scope->name->val, fbc->common.function_name->val); + ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name)); } else { zend_error( E_EXCEPTION | E_ERROR, "Non-static method %s::%s() cannot be called statically", - fbc->common.scope->name->val, fbc->common.function_name->val); + ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name)); FREE_OP2(); HANDLE_EXCEPTION(); } @@ -3378,7 +3378,7 @@ ZEND_VM_C_LABEL(try_function_name): fbc = Z_OBJ_HT_P(obj)->get_method(&object, Z_STR_P(method), NULL); if (UNEXPECTED(fbc == NULL)) { if (EXPECTED(!EG(exception))) { - zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", object->ce->name->val, Z_STRVAL_P(method)); + zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(object->ce->name), Z_STRVAL_P(method)); } FREE_OP2(); HANDLE_EXCEPTION(); @@ -3452,7 +3452,7 @@ ZEND_VM_HANDLER(118, ZEND_INIT_USER_CALL, CONST, CONST|TMPVAR|CV) /* This is the only soft error is_callable() can generate */ zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically", - func->common.scope->name->val, func->common.function_name->val); + ZSTR_VAL(func->common.scope->name), ZSTR_VAL(func->common.function_name)); } } else { zend_internal_type_error(EX_USES_STRICT_TYPES(), "%s() expects parameter 1 to be a valid callback, %s", Z_STRVAL_P(EX_CONSTANT(opline->op1)), error); @@ -3648,9 +3648,9 @@ ZEND_VM_HANDLER(131, ZEND_DO_FCALL_BY_NAME, ANY, ANY) if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_DEPRECATED) != 0)) { zend_error(E_DEPRECATED, "Function %s%s%s() is deprecated", - fbc->common.scope ? fbc->common.scope->name->val : "", + fbc->common.scope ? ZSTR_VAL(fbc->common.scope->name) : "", fbc->common.scope ? "::" : "", - fbc->common.function_name->val); + ZSTR_VAL(fbc->common.function_name)); if (UNEXPECTED(EG(exception) != NULL)) { HANDLE_EXCEPTION(); } @@ -3722,14 +3722,14 @@ ZEND_VM_HANDLER(60, ZEND_DO_FCALL, ANY, ANY) EX(call) = call->prev_execute_data; if (UNEXPECTED((fbc->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED)) != 0)) { if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_ABSTRACT) != 0)) { - zend_error(E_EXCEPTION | E_ERROR, "Cannot call abstract method %s::%s()", fbc->common.scope->name->val, fbc->common.function_name->val); + zend_error(E_EXCEPTION | E_ERROR, "Cannot call abstract method %s::%s()", ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name)); HANDLE_EXCEPTION(); } if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_DEPRECATED) != 0)) { zend_error(E_DEPRECATED, "Function %s%s%s() is deprecated", - fbc->common.scope ? fbc->common.scope->name->val : "", + fbc->common.scope ? ZSTR_VAL(fbc->common.scope->name) : "", fbc->common.scope ? "::" : "", - fbc->common.function_name->val); + ZSTR_VAL(fbc->common.function_name)); if (UNEXPECTED(EG(exception) != NULL)) { HANDLE_EXCEPTION(); } @@ -4488,7 +4488,7 @@ ZEND_VM_C_LABEL(send_again): FREE_OP1(); if (!EG(exception)) { zend_throw_exception_ex( - NULL, 0, "Object of type %s did not create an Iterator", ce->name->val + NULL, 0, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name) ); } HANDLE_EXCEPTION(); @@ -4534,9 +4534,9 @@ ZEND_VM_C_LABEL(send_again): zend_error( E_WARNING, "Cannot pass by-reference argument %d of %s%s%s()" " by unpacking a Traversable, passing by-value instead", arg_num, - EX(call)->func->common.scope ? EX(call)->func->common.scope->name->val : "", + EX(call)->func->common.scope ? ZSTR_VAL(EX(call)->func->common.scope->name) : "", EX(call)->func->common.scope ? "::" : "", - EX(call)->func->common.function_name->val + ZSTR_VAL(EX(call)->func->common.function_name) ); } @@ -4636,9 +4636,9 @@ ZEND_VM_C_LABEL(send_array): zend_error(E_WARNING, "Parameter %d to %s%s%s() expected to be a reference, value given", arg_num, - EX(call)->func->common.scope ? EX(call)->func->common.scope->name->val : "", + EX(call)->func->common.scope ? ZSTR_VAL(EX(call)->func->common.scope->name) : "", EX(call)->func->common.scope ? "::" : "", - EX(call)->func->common.function_name->val); + ZSTR_VAL(EX(call)->func->common.function_name)); if (ZEND_CALL_INFO(EX(call)) & ZEND_CALL_CLOSURE) { OBJ_RELEASE((zend_object*)EX(call)->func->common.prototype); @@ -4694,9 +4694,9 @@ ZEND_VM_HANDLER(120, ZEND_SEND_USER, VAR|CV, ANY) zend_error(E_WARNING, "Parameter %d to %s%s%s() expected to be a reference, value given", opline->op2.num, - EX(call)->func->common.scope ? EX(call)->func->common.scope->name->val : "", + EX(call)->func->common.scope ? ZSTR_VAL(EX(call)->func->common.scope->name) : "", EX(call)->func->common.scope ? "::" : "", - EX(call)->func->common.function_name->val); + ZSTR_VAL(EX(call)->func->common.function_name)); if (ZEND_CALL_INFO(EX(call)) & ZEND_CALL_CLOSURE) { OBJ_RELEASE((zend_object*)EX(call)->func->common.prototype); @@ -5051,7 +5051,7 @@ ZEND_VM_HANDLER(110, ZEND_CLONE, CONST|TMPVAR|UNUSED|CV, ANY) clone_call = Z_OBJ_HT_P(obj)->clone_obj; if (UNEXPECTED(clone_call == NULL)) { if (ce) { - zend_error(E_EXCEPTION | E_ERROR, "Trying to clone an uncloneable object of class %s", ce->name->val); + zend_error(E_EXCEPTION | E_ERROR, "Trying to clone an uncloneable object of class %s", ZSTR_VAL(ce->name)); } else { zend_error(E_EXCEPTION | E_ERROR, "Trying to clone an uncloneable object"); } @@ -5064,7 +5064,7 @@ ZEND_VM_HANDLER(110, ZEND_CLONE, CONST|TMPVAR|UNUSED|CV, ANY) /* Ensure that if we're calling a private function, we're allowed to do so. */ if (UNEXPECTED(ce != EG(scope))) { - zend_error(E_EXCEPTION | E_ERROR, "Call to private %s::__clone() from context '%s'", ce->name->val, EG(scope) ? EG(scope)->name->val : ""); + zend_error(E_EXCEPTION | E_ERROR, "Call to private %s::__clone() from context '%s'", ZSTR_VAL(ce->name), EG(scope) ? ZSTR_VAL(EG(scope)->name) : ""); FREE_OP1(); HANDLE_EXCEPTION(); } @@ -5072,7 +5072,7 @@ ZEND_VM_HANDLER(110, ZEND_CLONE, CONST|TMPVAR|UNUSED|CV, ANY) /* Ensure that if we're calling a protected function, we're allowed to do so. */ if (UNEXPECTED(!zend_check_protected(zend_get_function_root_class(clone), EG(scope)))) { - zend_error(E_EXCEPTION | E_ERROR, "Call to protected %s::__clone() from context '%s'", ce->name->val, EG(scope) ? EG(scope)->name->val : ""); + zend_error(E_EXCEPTION | E_ERROR, "Call to protected %s::__clone() from context '%s'", ZSTR_VAL(ce->name), EG(scope) ? ZSTR_VAL(EG(scope)->name) : ""); FREE_OP1(); HANDLE_EXCEPTION(); } @@ -5477,7 +5477,7 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMPVAR|CV, ANY) if (failure_retval) { /* do nothing, file already included */ - } else if (SUCCESS == zend_stream_open(resolved_path->val, &file_handle)) { + } else if (SUCCESS == zend_stream_open(ZSTR_VAL(resolved_path), &file_handle)) { if (!file_handle.opened_path) { file_handle.opened_path = zend_string_copy(resolved_path); @@ -5853,7 +5853,7 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET_R, CONST|TMP|VAR|CV, ANY) if (UNEXPECTED(!iter) || UNEXPECTED(EG(exception))) { FREE_OP1(); if (!EG(exception)) { - zend_throw_exception_ex(NULL, 0, "Object of type %s did not create an Iterator", ce->name->val); + zend_throw_exception_ex(NULL, 0, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name)); } zend_throw_exception_internal(NULL); HANDLE_EXCEPTION(); @@ -6004,7 +6004,7 @@ ZEND_VM_HANDLER(125, ZEND_FE_RESET_RW, CONST|TMP|VAR|CV, ANY) FREE_OP1(); } if (!EG(exception)) { - zend_throw_exception_ex(NULL, 0, "Object of type %s did not create an Iterator", ce->name->val); + zend_throw_exception_ex(NULL, 0, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name)); } zend_throw_exception_internal(NULL); HANDLE_EXCEPTION(); @@ -6151,7 +6151,7 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH_R, VAR, ANY) if (opline->result_type == IS_TMP_VAR) { if (UNEXPECTED(!p->key)) { ZVAL_LONG(EX_VAR(opline->result.var), p->h); - } else if (p->key->val[0]) { + } else if (ZSTR_VAL(p->key)[0]) { ZVAL_STR_COPY(EX_VAR(opline->result.var), p->key); } else { const char *class_name, *prop_name; @@ -6342,7 +6342,7 @@ ZEND_VM_HANDLER(126, ZEND_FE_FETCH_RW, VAR, ANY) if (opline->result_type == IS_TMP_VAR) { if (UNEXPECTED(!p->key)) { ZVAL_LONG(EX_VAR(opline->result.var), p->h); - } else if (p->key->val[0]) { + } else if (ZSTR_VAL(p->key)[0]) { ZVAL_STR_COPY(EX_VAR(opline->result.var), p->key); } else { const char *class_name, *prop_name; @@ -7125,7 +7125,7 @@ ZEND_VM_HANDLER(144, ZEND_ADD_INTERFACE, ANY, CONST) } if (UNEXPECTED((iface->ce_flags & ZEND_ACC_INTERFACE) == 0)) { - zend_error_noreturn(E_ERROR, "%s cannot implement %s - it is not an interface", ce->name->val, iface->name->val); + zend_error_noreturn(E_ERROR, "%s cannot implement %s - it is not an interface", ZSTR_VAL(ce->name), ZSTR_VAL(iface->name)); } zend_do_implement_interface(ce, iface); @@ -7151,7 +7151,7 @@ ZEND_VM_HANDLER(154, ZEND_ADD_TRAIT, ANY, ANY) ZEND_VM_NEXT_OPCODE(); } if (!(trait->ce_flags & ZEND_ACC_TRAIT)) { - zend_error_noreturn(E_ERROR, "%s cannot use %s - it is not a trait", ce->name->val, trait->name->val); + zend_error_noreturn(E_ERROR, "%s cannot use %s - it is not a trait", ZSTR_VAL(ce->name), ZSTR_VAL(trait->name)); } CACHE_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op2)), trait); } @@ -7550,7 +7550,7 @@ ZEND_VM_HANDLER(142, ZEND_YIELD_FROM, CONST|TMP|VAR|CV, ANY) if (UNEXPECTED(!iter) || UNEXPECTED(EG(exception))) { if (!EG(exception)) { - zend_error(E_ERROR | E_EXCEPTION, "Object of type %s did not create an Iterator", ce->name->val); + zend_error(E_ERROR | E_EXCEPTION, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name)); } HANDLE_EXCEPTION(); } @@ -7700,10 +7700,10 @@ ZEND_VM_HANDLER(168, ZEND_BIND_GLOBAL, CV, CONST) if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) && (EXPECTED(p->key == Z_STR_P(varname)) || - (EXPECTED(p->h == Z_STR_P(varname)->h) && + (EXPECTED(p->h == ZSTR_H(Z_STR_P(varname))) && EXPECTED(p->key != NULL) && - EXPECTED(p->key->len == Z_STRLEN_P(varname)) && - EXPECTED(memcmp(p->key->val, Z_STRVAL_P(varname), Z_STRLEN_P(varname)) == 0)))) { + EXPECTED(ZSTR_LEN(p->key) == Z_STRLEN_P(varname)) && + EXPECTED(memcmp(ZSTR_VAL(p->key), Z_STRVAL_P(varname), Z_STRLEN_P(varname)) == 0)))) { value = &EG(symbol_table).arData[idx].val; ZEND_VM_C_GOTO(check_indirect); @@ -7790,7 +7790,7 @@ ZEND_VM_C_LABEL(try_strlen): ZVAL_COPY(&tmp, value); if (zend_parse_arg_str_weak(&tmp, &str)) { - ZVAL_LONG(EX_VAR(opline->result.var), str->len); + ZVAL_LONG(EX_VAR(opline->result.var), ZSTR_LEN(str)); zval_ptr_dtor(&tmp); break; } @@ -7818,8 +7818,8 @@ ZEND_VM_HANDLER(123, ZEND_TYPE_CHECK, CONST|TMP|VAR|CV, ANY) if (OP1_TYPE != IS_CONST && UNEXPECTED(Z_TYPE_P(value) == IS_OBJECT)) { zend_class_entry *ce = Z_OBJCE_P(value); - if (UNEXPECTED(ce->name->len != sizeof("__PHP_Incomplete_Class") - 1) || - EXPECTED(memcmp(ce->name->val, "__PHP_Incomplete_Class", sizeof("__PHP_Incomplete_Class") - 1) != 0)) { + if (UNEXPECTED(ZSTR_LEN(ce->name) != sizeof("__PHP_Incomplete_Class") - 1) || + EXPECTED(memcmp(ZSTR_VAL(ce->name), "__PHP_Incomplete_Class", sizeof("__PHP_Incomplete_Class") - 1) != 0)) { result = 1; } } else if (UNEXPECTED(Z_TYPE_P(value) == IS_RESOURCE)) { diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index ffe90f4e22..994a15859c 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -671,9 +671,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER( if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_DEPRECATED) != 0)) { zend_error(E_DEPRECATED, "Function %s%s%s() is deprecated", - fbc->common.scope ? fbc->common.scope->name->val : "", + fbc->common.scope ? ZSTR_VAL(fbc->common.scope->name) : "", fbc->common.scope ? "::" : "", - fbc->common.function_name->val); + ZSTR_VAL(fbc->common.function_name)); if (UNEXPECTED(EG(exception) != NULL)) { HANDLE_EXCEPTION(); } @@ -745,14 +745,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_FCALL_SPEC_HANDLER(ZEND_OPC EX(call) = call->prev_execute_data; if (UNEXPECTED((fbc->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED)) != 0)) { if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_ABSTRACT) != 0)) { - zend_error(E_EXCEPTION | E_ERROR, "Cannot call abstract method %s::%s()", fbc->common.scope->name->val, fbc->common.function_name->val); + zend_error(E_EXCEPTION | E_ERROR, "Cannot call abstract method %s::%s()", ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name)); HANDLE_EXCEPTION(); } if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_DEPRECATED) != 0)) { zend_error(E_DEPRECATED, "Function %s%s%s() is deprecated", - fbc->common.scope ? fbc->common.scope->name->val : "", + fbc->common.scope ? ZSTR_VAL(fbc->common.scope->name) : "", fbc->common.scope ? "::" : "", - fbc->common.function_name->val); + ZSTR_VAL(fbc->common.function_name)); if (UNEXPECTED(EG(exception) != NULL)) { HANDLE_EXCEPTION(); } @@ -1008,7 +1008,7 @@ send_again: FREE_OP(free_op1); if (!EG(exception)) { zend_throw_exception_ex( - NULL, 0, "Object of type %s did not create an Iterator", ce->name->val + NULL, 0, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name) ); } HANDLE_EXCEPTION(); @@ -1054,9 +1054,9 @@ send_again: zend_error( E_WARNING, "Cannot pass by-reference argument %d of %s%s%s()" " by unpacking a Traversable, passing by-value instead", arg_num, - EX(call)->func->common.scope ? EX(call)->func->common.scope->name->val : "", + EX(call)->func->common.scope ? ZSTR_VAL(EX(call)->func->common.scope->name) : "", EX(call)->func->common.scope ? "::" : "", - EX(call)->func->common.function_name->val + ZSTR_VAL(EX(call)->func->common.function_name) ); } @@ -1156,9 +1156,9 @@ send_array: zend_error(E_WARNING, "Parameter %d to %s%s%s() expected to be a reference, value given", arg_num, - EX(call)->func->common.scope ? EX(call)->func->common.scope->name->val : "", + EX(call)->func->common.scope ? ZSTR_VAL(EX(call)->func->common.scope->name) : "", EX(call)->func->common.scope ? "::" : "", - EX(call)->func->common.function_name->val); + ZSTR_VAL(EX(call)->func->common.function_name)); if (ZEND_CALL_INFO(EX(call)) & ZEND_CALL_CLOSURE) { OBJ_RELEASE((zend_object*)EX(call)->func->common.prototype); @@ -1453,7 +1453,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_TRAIT_SPEC_HANDLER(ZEND_OP ZEND_VM_NEXT_OPCODE(); } if (!(trait->ce_flags & ZEND_ACC_TRAIT)) { - zend_error_noreturn(E_ERROR, "%s cannot use %s - it is not a trait", ce->name->val, trait->name->val); + zend_error_noreturn(E_ERROR, "%s cannot use %s - it is not a trait", ZSTR_VAL(ce->name), ZSTR_VAL(trait->name)); } CACHE_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op2)), trait); } @@ -1961,7 +1961,7 @@ try_function_name: } if (UNEXPECTED(fbc == NULL)) { if (EXPECTED(!EG(exception))) { - zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", called_scope->name->val, mname->val); + zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(called_scope->name), ZSTR_VAL(mname)); } zend_string_release(lcname); zend_string_release(mname); @@ -1976,12 +1976,12 @@ try_function_name: if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically", - fbc->common.scope->name->val, fbc->common.function_name->val); + ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name)); } else { zend_error( E_EXCEPTION | E_ERROR, "Non-static method %s::%s() cannot be called statically", - fbc->common.scope->name->val, fbc->common.function_name->val); + ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name)); HANDLE_EXCEPTION(); } @@ -1989,7 +1989,7 @@ try_function_name: } else { if (Z_STRVAL_P(function_name)[0] == '\\') { lcname = zend_string_alloc(Z_STRLEN_P(function_name) - 1, 0); - zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name) + 1, Z_STRLEN_P(function_name) - 1); + zend_str_tolower_copy(ZSTR_VAL(lcname), Z_STRVAL_P(function_name) + 1, Z_STRLEN_P(function_name) - 1); } else { lcname = zend_string_tolower(Z_STR_P(function_name)); } @@ -2059,7 +2059,7 @@ try_function_name: } if (UNEXPECTED(fbc == NULL)) { if (EXPECTED(!EG(exception))) { - zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", called_scope->name->val, Z_STRVAL_P(method)); + zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(called_scope->name), Z_STRVAL_P(method)); } HANDLE_EXCEPTION(); @@ -2068,12 +2068,12 @@ try_function_name: if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically", - fbc->common.scope->name->val, fbc->common.function_name->val); + ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name)); } else { zend_error( E_EXCEPTION | E_ERROR, "Non-static method %s::%s() cannot be called statically", - fbc->common.scope->name->val, fbc->common.function_name->val); + ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name)); HANDLE_EXCEPTION(); } @@ -2085,7 +2085,7 @@ try_function_name: fbc = Z_OBJ_HT_P(obj)->get_method(&object, Z_STR_P(method), NULL); if (UNEXPECTED(fbc == NULL)) { if (EXPECTED(!EG(exception))) { - zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", object->ce->name->val, Z_STRVAL_P(method)); + zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(object->ce->name), Z_STRVAL_P(method)); } HANDLE_EXCEPTION(); @@ -2268,7 +2268,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_INTERFACE_SPEC_CONST_HANDL } if (UNEXPECTED((iface->ce_flags & ZEND_ACC_INTERFACE) == 0)) { - zend_error_noreturn(E_ERROR, "%s cannot implement %s - it is not an interface", ce->name->val, iface->name->val); + zend_error_noreturn(E_ERROR, "%s cannot implement %s - it is not an interface", ZSTR_VAL(ce->name), ZSTR_VAL(iface->name)); } zend_do_implement_interface(ce, iface); @@ -2414,7 +2414,7 @@ try_function_name: } if (UNEXPECTED(fbc == NULL)) { if (EXPECTED(!EG(exception))) { - zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", called_scope->name->val, mname->val); + zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(called_scope->name), ZSTR_VAL(mname)); } zend_string_release(lcname); zend_string_release(mname); @@ -2429,12 +2429,12 @@ try_function_name: if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically", - fbc->common.scope->name->val, fbc->common.function_name->val); + ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name)); } else { zend_error( E_EXCEPTION | E_ERROR, "Non-static method %s::%s() cannot be called statically", - fbc->common.scope->name->val, fbc->common.function_name->val); + ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name)); HANDLE_EXCEPTION(); } @@ -2442,7 +2442,7 @@ try_function_name: } else { if (Z_STRVAL_P(function_name)[0] == '\\') { lcname = zend_string_alloc(Z_STRLEN_P(function_name) - 1, 0); - zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name) + 1, Z_STRLEN_P(function_name) - 1); + zend_str_tolower_copy(ZSTR_VAL(lcname), Z_STRVAL_P(function_name) + 1, Z_STRLEN_P(function_name) - 1); } else { lcname = zend_string_tolower(Z_STR_P(function_name)); } @@ -2512,7 +2512,7 @@ try_function_name: } if (UNEXPECTED(fbc == NULL)) { if (EXPECTED(!EG(exception))) { - zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", called_scope->name->val, Z_STRVAL_P(method)); + zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(called_scope->name), Z_STRVAL_P(method)); } HANDLE_EXCEPTION(); @@ -2521,12 +2521,12 @@ try_function_name: if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically", - fbc->common.scope->name->val, fbc->common.function_name->val); + ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name)); } else { zend_error( E_EXCEPTION | E_ERROR, "Non-static method %s::%s() cannot be called statically", - fbc->common.scope->name->val, fbc->common.function_name->val); + ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name)); HANDLE_EXCEPTION(); } @@ -2538,7 +2538,7 @@ try_function_name: fbc = Z_OBJ_HT_P(obj)->get_method(&object, Z_STR_P(method), NULL); if (UNEXPECTED(fbc == NULL)) { if (EXPECTED(!EG(exception))) { - zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", object->ce->name->val, Z_STRVAL_P(method)); + zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(object->ce->name), Z_STRVAL_P(method)); } HANDLE_EXCEPTION(); @@ -2668,7 +2668,7 @@ try_function_name: } if (UNEXPECTED(fbc == NULL)) { if (EXPECTED(!EG(exception))) { - zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", called_scope->name->val, mname->val); + zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(called_scope->name), ZSTR_VAL(mname)); } zend_string_release(lcname); zend_string_release(mname); @@ -2683,12 +2683,12 @@ try_function_name: if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically", - fbc->common.scope->name->val, fbc->common.function_name->val); + ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name)); } else { zend_error( E_EXCEPTION | E_ERROR, "Non-static method %s::%s() cannot be called statically", - fbc->common.scope->name->val, fbc->common.function_name->val); + ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name)); zval_ptr_dtor_nogc(free_op2); HANDLE_EXCEPTION(); } @@ -2696,7 +2696,7 @@ try_function_name: } else { if (Z_STRVAL_P(function_name)[0] == '\\') { lcname = zend_string_alloc(Z_STRLEN_P(function_name) - 1, 0); - zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name) + 1, Z_STRLEN_P(function_name) - 1); + zend_str_tolower_copy(ZSTR_VAL(lcname), Z_STRVAL_P(function_name) + 1, Z_STRLEN_P(function_name) - 1); } else { lcname = zend_string_tolower(Z_STR_P(function_name)); } @@ -2766,7 +2766,7 @@ try_function_name: } if (UNEXPECTED(fbc == NULL)) { if (EXPECTED(!EG(exception))) { - zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", called_scope->name->val, Z_STRVAL_P(method)); + zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(called_scope->name), Z_STRVAL_P(method)); } zval_ptr_dtor_nogc(free_op2); HANDLE_EXCEPTION(); @@ -2775,12 +2775,12 @@ try_function_name: if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically", - fbc->common.scope->name->val, fbc->common.function_name->val); + ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name)); } else { zend_error( E_EXCEPTION | E_ERROR, "Non-static method %s::%s() cannot be called statically", - fbc->common.scope->name->val, fbc->common.function_name->val); + ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name)); zval_ptr_dtor_nogc(free_op2); HANDLE_EXCEPTION(); } @@ -2792,7 +2792,7 @@ try_function_name: fbc = Z_OBJ_HT_P(obj)->get_method(&object, Z_STR_P(method), NULL); if (UNEXPECTED(fbc == NULL)) { if (EXPECTED(!EG(exception))) { - zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", object->ce->name->val, Z_STRVAL_P(method)); + zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(object->ce->name), Z_STRVAL_P(method)); } zval_ptr_dtor_nogc(free_op2); HANDLE_EXCEPTION(); @@ -2879,14 +2879,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ECHO_SPEC_CONST_HANDLER(ZEND_O if (Z_TYPE_P(z) == IS_STRING) { zend_string *str = Z_STR_P(z); - if (str->len != 0) { - zend_write(str->val, str->len); + if (ZSTR_LEN(str) != 0) { + zend_write(ZSTR_VAL(str), ZSTR_LEN(str)); } } else { zend_string *str = _zval_get_string_func(z); - if (str->len != 0) { - zend_write(str->val, str->len); + if (ZSTR_LEN(str) != 0) { + zend_write(ZSTR_VAL(str), ZSTR_LEN(str)); } else if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(z) == IS_UNDEF)) { GET_OP1_UNDEF_CV(z, BP_VAR_R); } @@ -3462,7 +3462,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_CONST_HANDLER(ZEND_ clone_call = Z_OBJ_HT_P(obj)->clone_obj; if (UNEXPECTED(clone_call == NULL)) { if (ce) { - zend_error(E_EXCEPTION | E_ERROR, "Trying to clone an uncloneable object of class %s", ce->name->val); + zend_error(E_EXCEPTION | E_ERROR, "Trying to clone an uncloneable object of class %s", ZSTR_VAL(ce->name)); } else { zend_error(E_EXCEPTION | E_ERROR, "Trying to clone an uncloneable object"); } @@ -3475,7 +3475,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_CONST_HANDLER(ZEND_ /* Ensure that if we're calling a private function, we're allowed to do so. */ if (UNEXPECTED(ce != EG(scope))) { - zend_error(E_EXCEPTION | E_ERROR, "Call to private %s::__clone() from context '%s'", ce->name->val, EG(scope) ? EG(scope)->name->val : ""); + zend_error(E_EXCEPTION | E_ERROR, "Call to private %s::__clone() from context '%s'", ZSTR_VAL(ce->name), EG(scope) ? ZSTR_VAL(EG(scope)->name) : ""); HANDLE_EXCEPTION(); } @@ -3483,7 +3483,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_CONST_HANDLER(ZEND_ /* Ensure that if we're calling a protected function, we're allowed to do so. */ if (UNEXPECTED(!zend_check_protected(zend_get_function_root_class(clone), EG(scope)))) { - zend_error(E_EXCEPTION | E_ERROR, "Call to protected %s::__clone() from context '%s'", ce->name->val, EG(scope) ? EG(scope)->name->val : ""); + zend_error(E_EXCEPTION | E_ERROR, "Call to protected %s::__clone() from context '%s'", ZSTR_VAL(ce->name), EG(scope) ? ZSTR_VAL(EG(scope)->name) : ""); HANDLE_EXCEPTION(); } @@ -3646,7 +3646,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HAN if (failure_retval) { /* do nothing, file already included */ - } else if (SUCCESS == zend_stream_open(resolved_path->val, &file_handle)) { + } else if (SUCCESS == zend_stream_open(ZSTR_VAL(resolved_path), &file_handle)) { if (!file_handle.opened_path) { file_handle.opened_path = zend_string_copy(resolved_path); @@ -3793,7 +3793,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_CONST_HANDLER( if (UNEXPECTED(!iter) || UNEXPECTED(EG(exception))) { if (!EG(exception)) { - zend_throw_exception_ex(NULL, 0, "Object of type %s did not create an Iterator", ce->name->val); + zend_throw_exception_ex(NULL, 0, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name)); } zend_throw_exception_internal(NULL); HANDLE_EXCEPTION(); @@ -3941,7 +3941,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_CONST_HANDLER } if (!EG(exception)) { - zend_throw_exception_ex(NULL, 0, "Object of type %s did not create an Iterator", ce->name->val); + zend_throw_exception_ex(NULL, 0, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name)); } zend_throw_exception_internal(NULL); HANDLE_EXCEPTION(); @@ -4190,7 +4190,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_CONST_HANDLER( if (UNEXPECTED(!iter) || UNEXPECTED(EG(exception))) { if (!EG(exception)) { - zend_error(E_ERROR | E_EXCEPTION, "Object of type %s did not create an Iterator", ce->name->val); + zend_error(E_ERROR | E_EXCEPTION, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name)); } HANDLE_EXCEPTION(); } @@ -4257,7 +4257,7 @@ try_strlen: ZVAL_COPY(&tmp, value); if (zend_parse_arg_str_weak(&tmp, &str)) { - ZVAL_LONG(EX_VAR(opline->result.var), str->len); + ZVAL_LONG(EX_VAR(opline->result.var), ZSTR_LEN(str)); zval_ptr_dtor(&tmp); break; } @@ -4285,8 +4285,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_TYPE_CHECK_SPEC_CONST_HANDLER( if (IS_CONST != IS_CONST && UNEXPECTED(Z_TYPE_P(value) == IS_OBJECT)) { zend_class_entry *ce = Z_OBJCE_P(value); - if (UNEXPECTED(ce->name->len != sizeof("__PHP_Incomplete_Class") - 1) || - EXPECTED(memcmp(ce->name->val, "__PHP_Incomplete_Class", sizeof("__PHP_Incomplete_Class") - 1) != 0)) { + if (UNEXPECTED(ZSTR_LEN(ce->name) != sizeof("__PHP_Incomplete_Class") - 1) || + EXPECTED(memcmp(ZSTR_VAL(ce->name), "__PHP_Incomplete_Class", sizeof("__PHP_Incomplete_Class") - 1) != 0)) { result = 1; } } else if (UNEXPECTED(Z_TYPE_P(value) == IS_RESOURCE)) { @@ -4569,14 +4569,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_CONST_CONST_HANDLE zend_string *str; if (IS_CONST != IS_CONST) { - if (UNEXPECTED(op1_str->len == 0)) { + if (UNEXPECTED(ZSTR_LEN(op1_str) == 0)) { ZVAL_STR_COPY(EX_VAR(opline->result.var), op2_str); break; } } if (IS_CONST != IS_CONST) { - if (UNEXPECTED(op2_str->len == 0)) { + if (UNEXPECTED(ZSTR_LEN(op2_str) == 0)) { ZVAL_STR_COPY(EX_VAR(opline->result.var), op1_str); break; @@ -4584,16 +4584,16 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_CONST_CONST_HANDLE } if (IS_CONST != IS_CONST && IS_CONST != IS_CV && !ZSTR_IS_INTERNED(op1_str) && GC_REFCOUNT(op1_str) == 1) { - size_t len = op1_str->len; + size_t len = ZSTR_LEN(op1_str); - str = zend_string_realloc(op1_str, len + op2_str->len, 0); - memcpy(str->val + len, op2_str->val, op2_str->len+1); + str = zend_string_realloc(op1_str, len + ZSTR_LEN(op2_str), 0); + memcpy(ZSTR_VAL(str) + len, ZSTR_VAL(op2_str), ZSTR_LEN(op2_str)+1); ZVAL_NEW_STR(EX_VAR(opline->result.var), str); break; } else { - str = zend_string_alloc(op1_str->len + op2_str->len, 0); - memcpy(str->val, op1_str->val, op1_str->len); - memcpy(str->val + op1_str->len, op2_str->val, op2_str->len+1); + str = zend_string_alloc(ZSTR_LEN(op1_str) + ZSTR_LEN(op2_str), 0); + memcpy(ZSTR_VAL(str), ZSTR_VAL(op1_str), ZSTR_LEN(op1_str)); + memcpy(ZSTR_VAL(str) + ZSTR_LEN(op1_str), ZSTR_VAL(op2_str), ZSTR_LEN(op2_str)+1); ZVAL_NEW_STR(EX_VAR(opline->result.var), str); } } else { @@ -5009,7 +5009,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_ /* check if static properties were destoyed */ if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) { - zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ce->name->val, name->val); + zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name)); HANDLE_EXCEPTION(); } @@ -5036,7 +5036,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_ /* check if static properties were destoyed */ if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) { - zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ce->name->val, name->val); + zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name)); HANDLE_EXCEPTION(); } @@ -5060,13 +5060,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_ switch (type) { case BP_VAR_R: case BP_VAR_UNSET: - zend_error(E_NOTICE,"Undefined variable: %s", name->val); + zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name)); /* break missing intentionally */ case BP_VAR_IS: retval = &EG(uninitialized_zval); break; case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined variable: %s", name->val); + zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name)); /* break missing intentionally */ case BP_VAR_W: retval = zend_hash_add_new(target_symbol_table, name, &EG(uninitialized_zval)); @@ -5080,13 +5080,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_ switch (type) { case BP_VAR_R: case BP_VAR_UNSET: - zend_error(E_NOTICE,"Undefined variable: %s", name->val); + zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name)); /* break missing intentionally */ case BP_VAR_IS: retval = &EG(uninitialized_zval); break; case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined variable: %s", name->val); + zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name)); /* break missing intentionally */ case BP_VAR_W: ZVAL_NULL(retval); @@ -5500,7 +5500,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_CONST_CONST_H } do { if (IS_CONST != IS_CONST) { - if (UNEXPECTED(op1_str->len == 0)) { + if (UNEXPECTED(ZSTR_LEN(op1_str) == 0)) { if (IS_CONST == IS_CONST) { zend_string_addref(op2_str); } @@ -5510,7 +5510,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_CONST_CONST_H } } if (IS_CONST != IS_CONST) { - if (UNEXPECTED(op2_str->len == 0)) { + if (UNEXPECTED(ZSTR_LEN(op2_str) == 0)) { if (IS_CONST == IS_CONST) { zend_string_addref(op1_str); } @@ -5519,9 +5519,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_CONST_CONST_H break; } } - str = zend_string_alloc(op1_str->len + op2_str->len, 0); - memcpy(str->val, op1_str->val, op1_str->len); - memcpy(str->val + op1_str->len, op2_str->val, op2_str->len+1); + str = zend_string_alloc(ZSTR_LEN(op1_str) + ZSTR_LEN(op2_str), 0); + memcpy(ZSTR_VAL(str), ZSTR_VAL(op1_str), ZSTR_LEN(op1_str)); + memcpy(ZSTR_VAL(str) + ZSTR_LEN(op1_str), ZSTR_VAL(op2_str), ZSTR_LEN(op2_str)+1); ZVAL_NEW_STR(EX_VAR(opline->result.var), str); if (IS_CONST != IS_CONST) { zend_string_release(op1_str); @@ -5623,7 +5623,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CONST_CO fbc = obj->handlers->get_method(&obj, Z_STR_P(function_name), ((IS_CONST == IS_CONST) ? (EX_CONSTANT(opline->op2) + 1) : NULL)); if (UNEXPECTED(fbc == NULL)) { if (EXPECTED(!EG(exception))) { - zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", obj->ce->name->val, Z_STRVAL_P(function_name)); + zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(obj->ce->name), Z_STRVAL_P(function_name)); } @@ -5719,7 +5719,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C } if (UNEXPECTED(fbc == NULL)) { if (EXPECTED(!EG(exception))) { - zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ce->name->val, Z_STRVAL_P(function_name)); + zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(ce->name), Z_STRVAL_P(function_name)); } HANDLE_EXCEPTION(); @@ -5742,7 +5742,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C HANDLE_EXCEPTION(); } if (Z_OBJ(EX(This)) && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) { - zend_error(E_EXCEPTION | E_ERROR, "Cannot call private %s::__construct()", ce->name->val); + zend_error(E_EXCEPTION | E_ERROR, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name)); HANDLE_EXCEPTION(); } fbc = ce->constructor; @@ -5759,14 +5759,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C zend_error( E_DEPRECATED, "Non-static method %s::%s() should not be called statically", - fbc->common.scope->name->val, fbc->common.function_name->val); + ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name)); } else { /* An internal function assumes $this is present and won't check that. * So PHP would crash by allowing the call. */ zend_error( E_EXCEPTION | E_ERROR, "Non-static method %s::%s() cannot be called statically", - fbc->common.scope->name->val, fbc->common.function_name->val); + ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name)); HANDLE_EXCEPTION(); } } @@ -5826,7 +5826,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_CONS /* This is the only soft error is_callable() can generate */ zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically", - func->common.scope->name->val, func->common.function_name->val); + ZSTR_VAL(func->common.scope->name), ZSTR_VAL(func->common.function_name)); } } else { zend_internal_type_error(EX_USES_STRICT_TYPES(), "%s() expects parameter 1 to be a valid callback, %s", Z_STRVAL_P(EX_CONSTANT(opline->op1)), error); @@ -6978,7 +6978,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_ /* check if static properties were destoyed */ if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) { - zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ce->name->val, name->val); + zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name)); HANDLE_EXCEPTION(); } @@ -7005,7 +7005,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_ /* check if static properties were destoyed */ if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) { - zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ce->name->val, name->val); + zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name)); HANDLE_EXCEPTION(); } @@ -7029,13 +7029,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_ switch (type) { case BP_VAR_R: case BP_VAR_UNSET: - zend_error(E_NOTICE,"Undefined variable: %s", name->val); + zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name)); /* break missing intentionally */ case BP_VAR_IS: retval = &EG(uninitialized_zval); break; case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined variable: %s", name->val); + zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name)); /* break missing intentionally */ case BP_VAR_W: retval = zend_hash_add_new(target_symbol_table, name, &EG(uninitialized_zval)); @@ -7049,13 +7049,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_ switch (type) { case BP_VAR_R: case BP_VAR_UNSET: - zend_error(E_NOTICE,"Undefined variable: %s", name->val); + zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name)); /* break missing intentionally */ case BP_VAR_IS: retval = &EG(uninitialized_zval); break; case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined variable: %s", name->val); + zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name)); /* break missing intentionally */ case BP_VAR_W: ZVAL_NULL(retval); @@ -7493,7 +7493,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_ /* check if static properties were destoyed */ if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) { - zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ce->name->val, name->val); + zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name)); HANDLE_EXCEPTION(); } @@ -7520,7 +7520,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_ /* check if static properties were destoyed */ if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) { - zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ce->name->val, name->val); + zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name)); HANDLE_EXCEPTION(); } @@ -7544,13 +7544,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_ switch (type) { case BP_VAR_R: case BP_VAR_UNSET: - zend_error(E_NOTICE,"Undefined variable: %s", name->val); + zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name)); /* break missing intentionally */ case BP_VAR_IS: retval = &EG(uninitialized_zval); break; case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined variable: %s", name->val); + zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name)); /* break missing intentionally */ case BP_VAR_W: retval = zend_hash_add_new(target_symbol_table, name, &EG(uninitialized_zval)); @@ -7564,13 +7564,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_ switch (type) { case BP_VAR_R: case BP_VAR_UNSET: - zend_error(E_NOTICE,"Undefined variable: %s", name->val); + zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name)); /* break missing intentionally */ case BP_VAR_IS: retval = &EG(uninitialized_zval); break; case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined variable: %s", name->val); + zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name)); /* break missing intentionally */ case BP_VAR_W: ZVAL_NULL(retval); @@ -7751,7 +7751,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C } if (UNEXPECTED(fbc == NULL)) { if (EXPECTED(!EG(exception))) { - zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ce->name->val, Z_STRVAL_P(function_name)); + zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(ce->name), Z_STRVAL_P(function_name)); } HANDLE_EXCEPTION(); @@ -7774,7 +7774,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C HANDLE_EXCEPTION(); } if (Z_OBJ(EX(This)) && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) { - zend_error(E_EXCEPTION | E_ERROR, "Cannot call private %s::__construct()", ce->name->val); + zend_error(E_EXCEPTION | E_ERROR, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name)); HANDLE_EXCEPTION(); } fbc = ce->constructor; @@ -7791,14 +7791,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C zend_error( E_DEPRECATED, "Non-static method %s::%s() should not be called statically", - fbc->common.scope->name->val, fbc->common.function_name->val); + ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name)); } else { /* An internal function assumes $this is present and won't check that. * So PHP would crash by allowing the call. */ zend_error( E_EXCEPTION | E_ERROR, "Non-static method %s::%s() cannot be called statically", - fbc->common.scope->name->val, fbc->common.function_name->val); + ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name)); HANDLE_EXCEPTION(); } } @@ -8592,14 +8592,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_CONST_CV_HANDLER(Z zend_string *str; if (IS_CONST != IS_CONST) { - if (UNEXPECTED(op1_str->len == 0)) { + if (UNEXPECTED(ZSTR_LEN(op1_str) == 0)) { ZVAL_STR_COPY(EX_VAR(opline->result.var), op2_str); break; } } if (IS_CV != IS_CONST) { - if (UNEXPECTED(op2_str->len == 0)) { + if (UNEXPECTED(ZSTR_LEN(op2_str) == 0)) { ZVAL_STR_COPY(EX_VAR(opline->result.var), op1_str); break; @@ -8607,16 +8607,16 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_CONST_CV_HANDLER(Z } if (IS_CONST != IS_CONST && IS_CONST != IS_CV && !ZSTR_IS_INTERNED(op1_str) && GC_REFCOUNT(op1_str) == 1) { - size_t len = op1_str->len; + size_t len = ZSTR_LEN(op1_str); - str = zend_string_realloc(op1_str, len + op2_str->len, 0); - memcpy(str->val + len, op2_str->val, op2_str->len+1); + str = zend_string_realloc(op1_str, len + ZSTR_LEN(op2_str), 0); + memcpy(ZSTR_VAL(str) + len, ZSTR_VAL(op2_str), ZSTR_LEN(op2_str)+1); ZVAL_NEW_STR(EX_VAR(opline->result.var), str); break; } else { - str = zend_string_alloc(op1_str->len + op2_str->len, 0); - memcpy(str->val, op1_str->val, op1_str->len); - memcpy(str->val + op1_str->len, op2_str->val, op2_str->len+1); + str = zend_string_alloc(ZSTR_LEN(op1_str) + ZSTR_LEN(op2_str), 0); + memcpy(ZSTR_VAL(str), ZSTR_VAL(op1_str), ZSTR_LEN(op1_str)); + memcpy(ZSTR_VAL(str) + ZSTR_LEN(op1_str), ZSTR_VAL(op2_str), ZSTR_LEN(op2_str)+1); ZVAL_NEW_STR(EX_VAR(opline->result.var), str); } } else { @@ -9291,7 +9291,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_CONST_CV_HAND } do { if (IS_CONST != IS_CONST) { - if (UNEXPECTED(op1_str->len == 0)) { + if (UNEXPECTED(ZSTR_LEN(op1_str) == 0)) { if (IS_CV == IS_CONST) { zend_string_addref(op2_str); } @@ -9301,7 +9301,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_CONST_CV_HAND } } if (IS_CV != IS_CONST) { - if (UNEXPECTED(op2_str->len == 0)) { + if (UNEXPECTED(ZSTR_LEN(op2_str) == 0)) { if (IS_CONST == IS_CONST) { zend_string_addref(op1_str); } @@ -9310,9 +9310,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_CONST_CV_HAND break; } } - str = zend_string_alloc(op1_str->len + op2_str->len, 0); - memcpy(str->val, op1_str->val, op1_str->len); - memcpy(str->val + op1_str->len, op2_str->val, op2_str->len+1); + str = zend_string_alloc(ZSTR_LEN(op1_str) + ZSTR_LEN(op2_str), 0); + memcpy(ZSTR_VAL(str), ZSTR_VAL(op1_str), ZSTR_LEN(op1_str)); + memcpy(ZSTR_VAL(str) + ZSTR_LEN(op1_str), ZSTR_VAL(op2_str), ZSTR_LEN(op2_str)+1); ZVAL_NEW_STR(EX_VAR(opline->result.var), str); if (IS_CONST != IS_CONST) { zend_string_release(op1_str); @@ -9414,7 +9414,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CONST_CV fbc = obj->handlers->get_method(&obj, Z_STR_P(function_name), ((IS_CV == IS_CONST) ? (EX_CONSTANT(opline->op2) + 1) : NULL)); if (UNEXPECTED(fbc == NULL)) { if (EXPECTED(!EG(exception))) { - zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", obj->ce->name->val, Z_STRVAL_P(function_name)); + zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(obj->ce->name), Z_STRVAL_P(function_name)); } @@ -9510,7 +9510,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C } if (UNEXPECTED(fbc == NULL)) { if (EXPECTED(!EG(exception))) { - zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ce->name->val, Z_STRVAL_P(function_name)); + zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(ce->name), Z_STRVAL_P(function_name)); } HANDLE_EXCEPTION(); @@ -9533,7 +9533,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C HANDLE_EXCEPTION(); } if (Z_OBJ(EX(This)) && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) { - zend_error(E_EXCEPTION | E_ERROR, "Cannot call private %s::__construct()", ce->name->val); + zend_error(E_EXCEPTION | E_ERROR, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name)); HANDLE_EXCEPTION(); } fbc = ce->constructor; @@ -9550,14 +9550,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C zend_error( E_DEPRECATED, "Non-static method %s::%s() should not be called statically", - fbc->common.scope->name->val, fbc->common.function_name->val); + ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name)); } else { /* An internal function assumes $this is present and won't check that. * So PHP would crash by allowing the call. */ zend_error( E_EXCEPTION | E_ERROR, "Non-static method %s::%s() cannot be called statically", - fbc->common.scope->name->val, fbc->common.function_name->val); + ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name)); HANDLE_EXCEPTION(); } } @@ -9617,7 +9617,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_CV_H /* This is the only soft error is_callable() can generate */ zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically", - func->common.scope->name->val, func->common.function_name->val); + ZSTR_VAL(func->common.scope->name), ZSTR_VAL(func->common.function_name)); } } else { zend_internal_type_error(EX_USES_STRICT_TYPES(), "%s() expects parameter 1 to be a valid callback, %s", Z_STRVAL_P(EX_CONSTANT(opline->op1)), error); @@ -10467,14 +10467,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_CONST_TMPVAR_HANDL zend_string *str; if (IS_CONST != IS_CONST) { - if (UNEXPECTED(op1_str->len == 0)) { + if (UNEXPECTED(ZSTR_LEN(op1_str) == 0)) { ZVAL_STR_COPY(EX_VAR(opline->result.var), op2_str); break; } } if ((IS_TMP_VAR|IS_VAR) != IS_CONST) { - if (UNEXPECTED(op2_str->len == 0)) { + if (UNEXPECTED(ZSTR_LEN(op2_str) == 0)) { ZVAL_STR_COPY(EX_VAR(opline->result.var), op1_str); break; @@ -10482,16 +10482,16 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_CONST_TMPVAR_HANDL } if (IS_CONST != IS_CONST && IS_CONST != IS_CV && !ZSTR_IS_INTERNED(op1_str) && GC_REFCOUNT(op1_str) == 1) { - size_t len = op1_str->len; + size_t len = ZSTR_LEN(op1_str); - str = zend_string_realloc(op1_str, len + op2_str->len, 0); - memcpy(str->val + len, op2_str->val, op2_str->len+1); + str = zend_string_realloc(op1_str, len + ZSTR_LEN(op2_str), 0); + memcpy(ZSTR_VAL(str) + len, ZSTR_VAL(op2_str), ZSTR_LEN(op2_str)+1); ZVAL_NEW_STR(EX_VAR(opline->result.var), str); break; } else { - str = zend_string_alloc(op1_str->len + op2_str->len, 0); - memcpy(str->val, op1_str->val, op1_str->len); - memcpy(str->val + op1_str->len, op2_str->val, op2_str->len+1); + str = zend_string_alloc(ZSTR_LEN(op1_str) + ZSTR_LEN(op2_str), 0); + memcpy(ZSTR_VAL(str), ZSTR_VAL(op1_str), ZSTR_LEN(op1_str)); + memcpy(ZSTR_VAL(str) + ZSTR_LEN(op1_str), ZSTR_VAL(op2_str), ZSTR_LEN(op2_str)+1); ZVAL_NEW_STR(EX_VAR(opline->result.var), str); } } else { @@ -11126,7 +11126,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_CONST_TMPVAR_ } do { if (IS_CONST != IS_CONST) { - if (UNEXPECTED(op1_str->len == 0)) { + if (UNEXPECTED(ZSTR_LEN(op1_str) == 0)) { if ((IS_TMP_VAR|IS_VAR) == IS_CONST) { zend_string_addref(op2_str); } @@ -11136,7 +11136,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_CONST_TMPVAR_ } } if ((IS_TMP_VAR|IS_VAR) != IS_CONST) { - if (UNEXPECTED(op2_str->len == 0)) { + if (UNEXPECTED(ZSTR_LEN(op2_str) == 0)) { if (IS_CONST == IS_CONST) { zend_string_addref(op1_str); } @@ -11145,9 +11145,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_CONST_TMPVAR_ break; } } - str = zend_string_alloc(op1_str->len + op2_str->len, 0); - memcpy(str->val, op1_str->val, op1_str->len); - memcpy(str->val + op1_str->len, op2_str->val, op2_str->len+1); + str = zend_string_alloc(ZSTR_LEN(op1_str) + ZSTR_LEN(op2_str), 0); + memcpy(ZSTR_VAL(str), ZSTR_VAL(op1_str), ZSTR_LEN(op1_str)); + memcpy(ZSTR_VAL(str) + ZSTR_LEN(op1_str), ZSTR_VAL(op2_str), ZSTR_LEN(op2_str)+1); ZVAL_NEW_STR(EX_VAR(opline->result.var), str); if (IS_CONST != IS_CONST) { zend_string_release(op1_str); @@ -11249,7 +11249,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CONST_TM fbc = obj->handlers->get_method(&obj, Z_STR_P(function_name), (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? (EX_CONSTANT(opline->op2) + 1) : NULL)); if (UNEXPECTED(fbc == NULL)) { if (EXPECTED(!EG(exception))) { - zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", obj->ce->name->val, Z_STRVAL_P(function_name)); + zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(obj->ce->name), Z_STRVAL_P(function_name)); } zval_ptr_dtor_nogc(free_op2); @@ -11346,7 +11346,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C } if (UNEXPECTED(fbc == NULL)) { if (EXPECTED(!EG(exception))) { - zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ce->name->val, Z_STRVAL_P(function_name)); + zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(ce->name), Z_STRVAL_P(function_name)); } zval_ptr_dtor_nogc(free_op2); HANDLE_EXCEPTION(); @@ -11369,7 +11369,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C HANDLE_EXCEPTION(); } if (Z_OBJ(EX(This)) && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) { - zend_error(E_EXCEPTION | E_ERROR, "Cannot call private %s::__construct()", ce->name->val); + zend_error(E_EXCEPTION | E_ERROR, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name)); HANDLE_EXCEPTION(); } fbc = ce->constructor; @@ -11386,14 +11386,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C zend_error( E_DEPRECATED, "Non-static method %s::%s() should not be called statically", - fbc->common.scope->name->val, fbc->common.function_name->val); + ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name)); } else { /* An internal function assumes $this is present and won't check that. * So PHP would crash by allowing the call. */ zend_error( E_EXCEPTION | E_ERROR, "Non-static method %s::%s() cannot be called statically", - fbc->common.scope->name->val, fbc->common.function_name->val); + ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name)); HANDLE_EXCEPTION(); } } @@ -11453,7 +11453,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_TMPV /* This is the only soft error is_callable() can generate */ zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically", - func->common.scope->name->val, func->common.function_name->val); + ZSTR_VAL(func->common.scope->name), ZSTR_VAL(func->common.function_name)); } } else { zend_internal_type_error(EX_USES_STRICT_TYPES(), "%s() expects parameter 1 to be a valid callback, %s", Z_STRVAL_P(EX_CONSTANT(opline->op1)), error); @@ -12280,7 +12280,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_TMP_HANDLER(ZE if (UNEXPECTED(!iter) || UNEXPECTED(EG(exception))) { zval_ptr_dtor_nogc(free_op1); if (!EG(exception)) { - zend_throw_exception_ex(NULL, 0, "Object of type %s did not create an Iterator", ce->name->val); + zend_throw_exception_ex(NULL, 0, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name)); } zend_throw_exception_internal(NULL); HANDLE_EXCEPTION(); @@ -12429,7 +12429,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_TMP_HANDLER(Z zval_ptr_dtor_nogc(free_op1); } if (!EG(exception)) { - zend_throw_exception_ex(NULL, 0, "Object of type %s did not create an Iterator", ce->name->val); + zend_throw_exception_ex(NULL, 0, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name)); } zend_throw_exception_internal(NULL); HANDLE_EXCEPTION(); @@ -12660,7 +12660,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_TMP_HANDLER(ZE if (UNEXPECTED(!iter) || UNEXPECTED(EG(exception))) { if (!EG(exception)) { - zend_error(E_ERROR | E_EXCEPTION, "Object of type %s did not create an Iterator", ce->name->val); + zend_error(E_ERROR | E_EXCEPTION, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name)); } HANDLE_EXCEPTION(); } @@ -12711,8 +12711,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_TYPE_CHECK_SPEC_TMP_HANDLER(ZE if (IS_TMP_VAR != IS_CONST && UNEXPECTED(Z_TYPE_P(value) == IS_OBJECT)) { zend_class_entry *ce = Z_OBJCE_P(value); - if (UNEXPECTED(ce->name->len != sizeof("__PHP_Incomplete_Class") - 1) || - EXPECTED(memcmp(ce->name->val, "__PHP_Incomplete_Class", sizeof("__PHP_Incomplete_Class") - 1) != 0)) { + if (UNEXPECTED(ZSTR_LEN(ce->name) != sizeof("__PHP_Incomplete_Class") - 1) || + EXPECTED(memcmp(ZSTR_VAL(ce->name), "__PHP_Incomplete_Class", sizeof("__PHP_Incomplete_Class") - 1) != 0)) { result = 1; } } else if (UNEXPECTED(Z_TYPE_P(value) == IS_RESOURCE)) { @@ -15492,9 +15492,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_USER_SPEC_VAR_HANDLER(ZEN zend_error(E_WARNING, "Parameter %d to %s%s%s() expected to be a reference, value given", opline->op2.num, - EX(call)->func->common.scope ? EX(call)->func->common.scope->name->val : "", + EX(call)->func->common.scope ? ZSTR_VAL(EX(call)->func->common.scope->name) : "", EX(call)->func->common.scope ? "::" : "", - EX(call)->func->common.function_name->val); + ZSTR_VAL(EX(call)->func->common.function_name)); if (ZEND_CALL_INFO(EX(call)) & ZEND_CALL_CLOSURE) { OBJ_RELEASE((zend_object*)EX(call)->func->common.prototype); @@ -15754,7 +15754,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_VAR_HANDLER(ZE if (UNEXPECTED(!iter) || UNEXPECTED(EG(exception))) { zval_ptr_dtor_nogc(free_op1); if (!EG(exception)) { - zend_throw_exception_ex(NULL, 0, "Object of type %s did not create an Iterator", ce->name->val); + zend_throw_exception_ex(NULL, 0, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name)); } zend_throw_exception_internal(NULL); HANDLE_EXCEPTION(); @@ -15905,7 +15905,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_VAR_HANDLER(Z zval_ptr_dtor_nogc(free_op1); } if (!EG(exception)) { - zend_throw_exception_ex(NULL, 0, "Object of type %s did not create an Iterator", ce->name->val); + zend_throw_exception_ex(NULL, 0, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name)); } zend_throw_exception_internal(NULL); HANDLE_EXCEPTION(); @@ -16052,7 +16052,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_FETCH_R_SPEC_VAR_HANDLER(ZE if (opline->result_type == IS_TMP_VAR) { if (UNEXPECTED(!p->key)) { ZVAL_LONG(EX_VAR(opline->result.var), p->h); - } else if (p->key->val[0]) { + } else if (ZSTR_VAL(p->key)[0]) { ZVAL_STR_COPY(EX_VAR(opline->result.var), p->key); } else { const char *class_name, *prop_name; @@ -16243,7 +16243,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_FETCH_RW_SPEC_VAR_HANDLER(Z if (opline->result_type == IS_TMP_VAR) { if (UNEXPECTED(!p->key)) { ZVAL_LONG(EX_VAR(opline->result.var), p->h); - } else if (p->key->val[0]) { + } else if (ZSTR_VAL(p->key)[0]) { ZVAL_STR_COPY(EX_VAR(opline->result.var), p->key); } else { const char *class_name, *prop_name; @@ -16504,7 +16504,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_VAR_HANDLER(ZE if (UNEXPECTED(!iter) || UNEXPECTED(EG(exception))) { if (!EG(exception)) { - zend_error(E_ERROR | E_EXCEPTION, "Object of type %s did not create an Iterator", ce->name->val); + zend_error(E_ERROR | E_EXCEPTION, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name)); } HANDLE_EXCEPTION(); } @@ -16555,8 +16555,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_TYPE_CHECK_SPEC_VAR_HANDLER(ZE if (IS_VAR != IS_CONST && UNEXPECTED(Z_TYPE_P(value) == IS_OBJECT)) { zend_class_entry *ce = Z_OBJCE_P(value); - if (UNEXPECTED(ce->name->len != sizeof("__PHP_Incomplete_Class") - 1) || - EXPECTED(memcmp(ce->name->val, "__PHP_Incomplete_Class", sizeof("__PHP_Incomplete_Class") - 1) != 0)) { + if (UNEXPECTED(ZSTR_LEN(ce->name) != sizeof("__PHP_Incomplete_Class") - 1) || + EXPECTED(memcmp(ZSTR_VAL(ce->name), "__PHP_Incomplete_Class", sizeof("__PHP_Incomplete_Class") - 1) != 0)) { result = 1; } } else if (UNEXPECTED(Z_TYPE_P(value) == IS_RESOURCE)) { @@ -17731,7 +17731,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V } if (UNEXPECTED(fbc == NULL)) { if (EXPECTED(!EG(exception))) { - zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ce->name->val, Z_STRVAL_P(function_name)); + zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(ce->name), Z_STRVAL_P(function_name)); } HANDLE_EXCEPTION(); @@ -17754,7 +17754,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V HANDLE_EXCEPTION(); } if (Z_OBJ(EX(This)) && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) { - zend_error(E_EXCEPTION | E_ERROR, "Cannot call private %s::__construct()", ce->name->val); + zend_error(E_EXCEPTION | E_ERROR, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name)); HANDLE_EXCEPTION(); } fbc = ce->constructor; @@ -17771,14 +17771,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V zend_error( E_DEPRECATED, "Non-static method %s::%s() should not be called statically", - fbc->common.scope->name->val, fbc->common.function_name->val); + ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name)); } else { /* An internal function assumes $this is present and won't check that. * So PHP would crash by allowing the call. */ zend_error( E_EXCEPTION | E_ERROR, "Non-static method %s::%s() cannot be called statically", - fbc->common.scope->name->val, fbc->common.function_name->val); + ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name)); HANDLE_EXCEPTION(); } } @@ -19371,7 +19371,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V } if (UNEXPECTED(fbc == NULL)) { if (EXPECTED(!EG(exception))) { - zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ce->name->val, Z_STRVAL_P(function_name)); + zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(ce->name), Z_STRVAL_P(function_name)); } HANDLE_EXCEPTION(); @@ -19394,7 +19394,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V HANDLE_EXCEPTION(); } if (Z_OBJ(EX(This)) && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) { - zend_error(E_EXCEPTION | E_ERROR, "Cannot call private %s::__construct()", ce->name->val); + zend_error(E_EXCEPTION | E_ERROR, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name)); HANDLE_EXCEPTION(); } fbc = ce->constructor; @@ -19411,14 +19411,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V zend_error( E_DEPRECATED, "Non-static method %s::%s() should not be called statically", - fbc->common.scope->name->val, fbc->common.function_name->val); + ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name)); } else { /* An internal function assumes $this is present and won't check that. * So PHP would crash by allowing the call. */ zend_error( E_EXCEPTION | E_ERROR, "Non-static method %s::%s() cannot be called statically", - fbc->common.scope->name->val, fbc->common.function_name->val); + ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name)); HANDLE_EXCEPTION(); } } @@ -20993,7 +20993,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V } if (UNEXPECTED(fbc == NULL)) { if (EXPECTED(!EG(exception))) { - zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ce->name->val, Z_STRVAL_P(function_name)); + zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(ce->name), Z_STRVAL_P(function_name)); } HANDLE_EXCEPTION(); @@ -21016,7 +21016,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V HANDLE_EXCEPTION(); } if (Z_OBJ(EX(This)) && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) { - zend_error(E_EXCEPTION | E_ERROR, "Cannot call private %s::__construct()", ce->name->val); + zend_error(E_EXCEPTION | E_ERROR, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name)); HANDLE_EXCEPTION(); } fbc = ce->constructor; @@ -21033,14 +21033,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V zend_error( E_DEPRECATED, "Non-static method %s::%s() should not be called statically", - fbc->common.scope->name->val, fbc->common.function_name->val); + ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name)); } else { /* An internal function assumes $this is present and won't check that. * So PHP would crash by allowing the call. */ zend_error( E_EXCEPTION | E_ERROR, "Non-static method %s::%s() cannot be called statically", - fbc->common.scope->name->val, fbc->common.function_name->val); + ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name)); HANDLE_EXCEPTION(); } } @@ -22570,7 +22570,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V } if (UNEXPECTED(fbc == NULL)) { if (EXPECTED(!EG(exception))) { - zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ce->name->val, Z_STRVAL_P(function_name)); + zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(ce->name), Z_STRVAL_P(function_name)); } zval_ptr_dtor_nogc(free_op2); HANDLE_EXCEPTION(); @@ -22593,7 +22593,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V HANDLE_EXCEPTION(); } if (Z_OBJ(EX(This)) && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) { - zend_error(E_EXCEPTION | E_ERROR, "Cannot call private %s::__construct()", ce->name->val); + zend_error(E_EXCEPTION | E_ERROR, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name)); HANDLE_EXCEPTION(); } fbc = ce->constructor; @@ -22610,14 +22610,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V zend_error( E_DEPRECATED, "Non-static method %s::%s() should not be called statically", - fbc->common.scope->name->val, fbc->common.function_name->val); + ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name)); } else { /* An internal function assumes $this is present and won't check that. * So PHP would crash by allowing the call. */ zend_error( E_EXCEPTION | E_ERROR, "Non-static method %s::%s() cannot be called statically", - fbc->common.scope->name->val, fbc->common.function_name->val); + ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name)); HANDLE_EXCEPTION(); } } @@ -22964,7 +22964,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_UNUSED_HANDLER(ZEND clone_call = Z_OBJ_HT_P(obj)->clone_obj; if (UNEXPECTED(clone_call == NULL)) { if (ce) { - zend_error(E_EXCEPTION | E_ERROR, "Trying to clone an uncloneable object of class %s", ce->name->val); + zend_error(E_EXCEPTION | E_ERROR, "Trying to clone an uncloneable object of class %s", ZSTR_VAL(ce->name)); } else { zend_error(E_EXCEPTION | E_ERROR, "Trying to clone an uncloneable object"); } @@ -22977,7 +22977,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_UNUSED_HANDLER(ZEND /* Ensure that if we're calling a private function, we're allowed to do so. */ if (UNEXPECTED(ce != EG(scope))) { - zend_error(E_EXCEPTION | E_ERROR, "Call to private %s::__clone() from context '%s'", ce->name->val, EG(scope) ? EG(scope)->name->val : ""); + zend_error(E_EXCEPTION | E_ERROR, "Call to private %s::__clone() from context '%s'", ZSTR_VAL(ce->name), EG(scope) ? ZSTR_VAL(EG(scope)->name) : ""); HANDLE_EXCEPTION(); } @@ -22985,7 +22985,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_UNUSED_HANDLER(ZEND /* Ensure that if we're calling a protected function, we're allowed to do so. */ if (UNEXPECTED(!zend_check_protected(zend_get_function_root_class(clone), EG(scope)))) { - zend_error(E_EXCEPTION | E_ERROR, "Call to protected %s::__clone() from context '%s'", ce->name->val, EG(scope) ? EG(scope)->name->val : ""); + zend_error(E_EXCEPTION | E_ERROR, "Call to protected %s::__clone() from context '%s'", ZSTR_VAL(ce->name), EG(scope) ? ZSTR_VAL(EG(scope)->name) : ""); HANDLE_EXCEPTION(); } @@ -23987,7 +23987,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_C fbc = obj->handlers->get_method(&obj, Z_STR_P(function_name), ((IS_CONST == IS_CONST) ? (EX_CONSTANT(opline->op2) + 1) : NULL)); if (UNEXPECTED(fbc == NULL)) { if (EXPECTED(!EG(exception))) { - zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", obj->ce->name->val, Z_STRVAL_P(function_name)); + zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(obj->ce->name), Z_STRVAL_P(function_name)); } @@ -26377,7 +26377,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_C fbc = obj->handlers->get_method(&obj, Z_STR_P(function_name), ((IS_CV == IS_CONST) ? (EX_CONSTANT(opline->op2) + 1) : NULL)); if (UNEXPECTED(fbc == NULL)) { if (EXPECTED(!EG(exception))) { - zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", obj->ce->name->val, Z_STRVAL_P(function_name)); + zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(obj->ce->name), Z_STRVAL_P(function_name)); } @@ -27868,7 +27868,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_UNUSED_T fbc = obj->handlers->get_method(&obj, Z_STR_P(function_name), (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? (EX_CONSTANT(opline->op2) + 1) : NULL)); if (UNEXPECTED(fbc == NULL)) { if (EXPECTED(!EG(exception))) { - zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", obj->ce->name->val, Z_STRVAL_P(function_name)); + zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(obj->ce->name), Z_STRVAL_P(function_name)); } zval_ptr_dtor_nogc(free_op2); @@ -28484,14 +28484,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ECHO_SPEC_CV_HANDLER(ZEND_OPCO if (Z_TYPE_P(z) == IS_STRING) { zend_string *str = Z_STR_P(z); - if (str->len != 0) { - zend_write(str->val, str->len); + if (ZSTR_LEN(str) != 0) { + zend_write(ZSTR_VAL(str), ZSTR_LEN(str)); } } else { zend_string *str = _zval_get_string_func(z); - if (str->len != 0) { - zend_write(str->val, str->len); + if (ZSTR_LEN(str) != 0) { + zend_write(ZSTR_VAL(str), ZSTR_LEN(str)); } else if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_P(z) == IS_UNDEF)) { GET_OP1_UNDEF_CV(z, BP_VAR_R); } @@ -29072,9 +29072,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_USER_SPEC_CV_HANDLER(ZEND zend_error(E_WARNING, "Parameter %d to %s%s%s() expected to be a reference, value given", opline->op2.num, - EX(call)->func->common.scope ? EX(call)->func->common.scope->name->val : "", + EX(call)->func->common.scope ? ZSTR_VAL(EX(call)->func->common.scope->name) : "", EX(call)->func->common.scope ? "::" : "", - EX(call)->func->common.function_name->val); + ZSTR_VAL(EX(call)->func->common.function_name)); if (ZEND_CALL_INFO(EX(call)) & ZEND_CALL_CLOSURE) { OBJ_RELEASE((zend_object*)EX(call)->func->common.prototype); @@ -29178,7 +29178,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_CV_HANDLER(ZEND_OPC clone_call = Z_OBJ_HT_P(obj)->clone_obj; if (UNEXPECTED(clone_call == NULL)) { if (ce) { - zend_error(E_EXCEPTION | E_ERROR, "Trying to clone an uncloneable object of class %s", ce->name->val); + zend_error(E_EXCEPTION | E_ERROR, "Trying to clone an uncloneable object of class %s", ZSTR_VAL(ce->name)); } else { zend_error(E_EXCEPTION | E_ERROR, "Trying to clone an uncloneable object"); } @@ -29191,7 +29191,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_CV_HANDLER(ZEND_OPC /* Ensure that if we're calling a private function, we're allowed to do so. */ if (UNEXPECTED(ce != EG(scope))) { - zend_error(E_EXCEPTION | E_ERROR, "Call to private %s::__clone() from context '%s'", ce->name->val, EG(scope) ? EG(scope)->name->val : ""); + zend_error(E_EXCEPTION | E_ERROR, "Call to private %s::__clone() from context '%s'", ZSTR_VAL(ce->name), EG(scope) ? ZSTR_VAL(EG(scope)->name) : ""); HANDLE_EXCEPTION(); } @@ -29199,7 +29199,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_CV_HANDLER(ZEND_OPC /* Ensure that if we're calling a protected function, we're allowed to do so. */ if (UNEXPECTED(!zend_check_protected(zend_get_function_root_class(clone), EG(scope)))) { - zend_error(E_EXCEPTION | E_ERROR, "Call to protected %s::__clone() from context '%s'", ce->name->val, EG(scope) ? EG(scope)->name->val : ""); + zend_error(E_EXCEPTION | E_ERROR, "Call to protected %s::__clone() from context '%s'", ZSTR_VAL(ce->name), EG(scope) ? ZSTR_VAL(EG(scope)->name) : ""); HANDLE_EXCEPTION(); } @@ -29362,7 +29362,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLE if (failure_retval) { /* do nothing, file already included */ - } else if (SUCCESS == zend_stream_open(resolved_path->val, &file_handle)) { + } else if (SUCCESS == zend_stream_open(ZSTR_VAL(resolved_path), &file_handle)) { if (!file_handle.opened_path) { file_handle.opened_path = zend_string_copy(resolved_path); @@ -29509,7 +29509,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_CV_HANDLER(ZEN if (UNEXPECTED(!iter) || UNEXPECTED(EG(exception))) { if (!EG(exception)) { - zend_throw_exception_ex(NULL, 0, "Object of type %s did not create an Iterator", ce->name->val); + zend_throw_exception_ex(NULL, 0, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name)); } zend_throw_exception_internal(NULL); HANDLE_EXCEPTION(); @@ -29657,7 +29657,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_CV_HANDLER(ZE } if (!EG(exception)) { - zend_throw_exception_ex(NULL, 0, "Object of type %s did not create an Iterator", ce->name->val); + zend_throw_exception_ex(NULL, 0, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name)); } zend_throw_exception_internal(NULL); HANDLE_EXCEPTION(); @@ -29906,7 +29906,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_CV_HANDLER(ZEN if (UNEXPECTED(!iter) || UNEXPECTED(EG(exception))) { if (!EG(exception)) { - zend_error(E_ERROR | E_EXCEPTION, "Object of type %s did not create an Iterator", ce->name->val); + zend_error(E_ERROR | E_EXCEPTION, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name)); } HANDLE_EXCEPTION(); } @@ -29973,7 +29973,7 @@ try_strlen: ZVAL_COPY(&tmp, value); if (zend_parse_arg_str_weak(&tmp, &str)) { - ZVAL_LONG(EX_VAR(opline->result.var), str->len); + ZVAL_LONG(EX_VAR(opline->result.var), ZSTR_LEN(str)); zval_ptr_dtor(&tmp); break; } @@ -30001,8 +30001,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_TYPE_CHECK_SPEC_CV_HANDLER(ZEN if (IS_CV != IS_CONST && UNEXPECTED(Z_TYPE_P(value) == IS_OBJECT)) { zend_class_entry *ce = Z_OBJCE_P(value); - if (UNEXPECTED(ce->name->len != sizeof("__PHP_Incomplete_Class") - 1) || - EXPECTED(memcmp(ce->name->val, "__PHP_Incomplete_Class", sizeof("__PHP_Incomplete_Class") - 1) != 0)) { + if (UNEXPECTED(ZSTR_LEN(ce->name) != sizeof("__PHP_Incomplete_Class") - 1) || + EXPECTED(memcmp(ZSTR_VAL(ce->name), "__PHP_Incomplete_Class", sizeof("__PHP_Incomplete_Class") - 1) != 0)) { result = 1; } } else if (UNEXPECTED(Z_TYPE_P(value) == IS_RESOURCE)) { @@ -30265,14 +30265,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_CV_CONST_HANDLER(Z zend_string *str; if (IS_CV != IS_CONST) { - if (UNEXPECTED(op1_str->len == 0)) { + if (UNEXPECTED(ZSTR_LEN(op1_str) == 0)) { ZVAL_STR_COPY(EX_VAR(opline->result.var), op2_str); break; } } if (IS_CONST != IS_CONST) { - if (UNEXPECTED(op2_str->len == 0)) { + if (UNEXPECTED(ZSTR_LEN(op2_str) == 0)) { ZVAL_STR_COPY(EX_VAR(opline->result.var), op1_str); break; @@ -30280,16 +30280,16 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_CV_CONST_HANDLER(Z } if (IS_CV != IS_CONST && IS_CV != IS_CV && !ZSTR_IS_INTERNED(op1_str) && GC_REFCOUNT(op1_str) == 1) { - size_t len = op1_str->len; + size_t len = ZSTR_LEN(op1_str); - str = zend_string_realloc(op1_str, len + op2_str->len, 0); - memcpy(str->val + len, op2_str->val, op2_str->len+1); + str = zend_string_realloc(op1_str, len + ZSTR_LEN(op2_str), 0); + memcpy(ZSTR_VAL(str) + len, ZSTR_VAL(op2_str), ZSTR_LEN(op2_str)+1); ZVAL_NEW_STR(EX_VAR(opline->result.var), str); break; } else { - str = zend_string_alloc(op1_str->len + op2_str->len, 0); - memcpy(str->val, op1_str->val, op1_str->len); - memcpy(str->val + op1_str->len, op2_str->val, op2_str->len+1); + str = zend_string_alloc(ZSTR_LEN(op1_str) + ZSTR_LEN(op2_str), 0); + memcpy(ZSTR_VAL(str), ZSTR_VAL(op1_str), ZSTR_LEN(op1_str)); + memcpy(ZSTR_VAL(str) + ZSTR_LEN(op1_str), ZSTR_VAL(op2_str), ZSTR_LEN(op2_str)+1); ZVAL_NEW_STR(EX_VAR(opline->result.var), str); } } else { @@ -31259,7 +31259,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_ /* check if static properties were destoyed */ if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) { - zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ce->name->val, name->val); + zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name)); HANDLE_EXCEPTION(); } @@ -31286,7 +31286,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_ /* check if static properties were destoyed */ if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) { - zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ce->name->val, name->val); + zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name)); HANDLE_EXCEPTION(); } @@ -31310,13 +31310,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_ switch (type) { case BP_VAR_R: case BP_VAR_UNSET: - zend_error(E_NOTICE,"Undefined variable: %s", name->val); + zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name)); /* break missing intentionally */ case BP_VAR_IS: retval = &EG(uninitialized_zval); break; case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined variable: %s", name->val); + zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name)); /* break missing intentionally */ case BP_VAR_W: retval = zend_hash_add_new(target_symbol_table, name, &EG(uninitialized_zval)); @@ -31330,13 +31330,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_ switch (type) { case BP_VAR_R: case BP_VAR_UNSET: - zend_error(E_NOTICE,"Undefined variable: %s", name->val); + zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name)); /* break missing intentionally */ case BP_VAR_IS: retval = &EG(uninitialized_zval); break; case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined variable: %s", name->val); + zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name)); /* break missing intentionally */ case BP_VAR_W: ZVAL_NULL(retval); @@ -32084,7 +32084,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_CV_CONST_HAND } do { if (IS_CV != IS_CONST) { - if (UNEXPECTED(op1_str->len == 0)) { + if (UNEXPECTED(ZSTR_LEN(op1_str) == 0)) { if (IS_CONST == IS_CONST) { zend_string_addref(op2_str); } @@ -32094,7 +32094,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_CV_CONST_HAND } } if (IS_CONST != IS_CONST) { - if (UNEXPECTED(op2_str->len == 0)) { + if (UNEXPECTED(ZSTR_LEN(op2_str) == 0)) { if (IS_CV == IS_CONST) { zend_string_addref(op1_str); } @@ -32103,9 +32103,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_CV_CONST_HAND break; } } - str = zend_string_alloc(op1_str->len + op2_str->len, 0); - memcpy(str->val, op1_str->val, op1_str->len); - memcpy(str->val + op1_str->len, op2_str->val, op2_str->len+1); + str = zend_string_alloc(ZSTR_LEN(op1_str) + ZSTR_LEN(op2_str), 0); + memcpy(ZSTR_VAL(str), ZSTR_VAL(op1_str), ZSTR_LEN(op1_str)); + memcpy(ZSTR_VAL(str) + ZSTR_LEN(op1_str), ZSTR_VAL(op2_str), ZSTR_LEN(op2_str)+1); ZVAL_NEW_STR(EX_VAR(opline->result.var), str); if (IS_CV != IS_CONST) { zend_string_release(op1_str); @@ -32207,7 +32207,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CONST fbc = obj->handlers->get_method(&obj, Z_STR_P(function_name), ((IS_CONST == IS_CONST) ? (EX_CONSTANT(opline->op2) + 1) : NULL)); if (UNEXPECTED(fbc == NULL)) { if (EXPECTED(!EG(exception))) { - zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", obj->ce->name->val, Z_STRVAL_P(function_name)); + zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(obj->ce->name), Z_STRVAL_P(function_name)); } @@ -33182,10 +33182,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BIND_GLOBAL_SPEC_CV_CONST_HAND if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) && (EXPECTED(p->key == Z_STR_P(varname)) || - (EXPECTED(p->h == Z_STR_P(varname)->h) && + (EXPECTED(p->h == ZSTR_H(Z_STR_P(varname))) && EXPECTED(p->key != NULL) && - EXPECTED(p->key->len == Z_STRLEN_P(varname)) && - EXPECTED(memcmp(p->key->val, Z_STRVAL_P(varname), Z_STRLEN_P(varname)) == 0)))) { + EXPECTED(ZSTR_LEN(p->key) == Z_STRLEN_P(varname)) && + EXPECTED(memcmp(ZSTR_VAL(p->key), Z_STRVAL_P(varname), Z_STRLEN_P(varname)) == 0)))) { value = &EG(symbol_table).arData[idx].val; goto check_indirect; @@ -33532,7 +33532,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_ /* check if static properties were destoyed */ if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) { - zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ce->name->val, name->val); + zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name)); HANDLE_EXCEPTION(); } @@ -33559,7 +33559,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_ /* check if static properties were destoyed */ if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) { - zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ce->name->val, name->val); + zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name)); HANDLE_EXCEPTION(); } @@ -33583,13 +33583,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_ switch (type) { case BP_VAR_R: case BP_VAR_UNSET: - zend_error(E_NOTICE,"Undefined variable: %s", name->val); + zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name)); /* break missing intentionally */ case BP_VAR_IS: retval = &EG(uninitialized_zval); break; case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined variable: %s", name->val); + zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name)); /* break missing intentionally */ case BP_VAR_W: retval = zend_hash_add_new(target_symbol_table, name, &EG(uninitialized_zval)); @@ -33603,13 +33603,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_ switch (type) { case BP_VAR_R: case BP_VAR_UNSET: - zend_error(E_NOTICE,"Undefined variable: %s", name->val); + zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name)); /* break missing intentionally */ case BP_VAR_IS: retval = &EG(uninitialized_zval); break; case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined variable: %s", name->val); + zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name)); /* break missing intentionally */ case BP_VAR_W: ZVAL_NULL(retval); @@ -34476,7 +34476,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_ /* check if static properties were destoyed */ if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) { - zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ce->name->val, name->val); + zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name)); HANDLE_EXCEPTION(); } @@ -34503,7 +34503,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_ /* check if static properties were destoyed */ if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) { - zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ce->name->val, name->val); + zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name)); HANDLE_EXCEPTION(); } @@ -34527,13 +34527,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_ switch (type) { case BP_VAR_R: case BP_VAR_UNSET: - zend_error(E_NOTICE,"Undefined variable: %s", name->val); + zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name)); /* break missing intentionally */ case BP_VAR_IS: retval = &EG(uninitialized_zval); break; case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined variable: %s", name->val); + zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name)); /* break missing intentionally */ case BP_VAR_W: retval = zend_hash_add_new(target_symbol_table, name, &EG(uninitialized_zval)); @@ -34547,13 +34547,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_ switch (type) { case BP_VAR_R: case BP_VAR_UNSET: - zend_error(E_NOTICE,"Undefined variable: %s", name->val); + zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name)); /* break missing intentionally */ case BP_VAR_IS: retval = &EG(uninitialized_zval); break; case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined variable: %s", name->val); + zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name)); /* break missing intentionally */ case BP_VAR_W: ZVAL_NULL(retval); @@ -35573,14 +35573,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_CV_CV_HANDLER(ZEND zend_string *str; if (IS_CV != IS_CONST) { - if (UNEXPECTED(op1_str->len == 0)) { + if (UNEXPECTED(ZSTR_LEN(op1_str) == 0)) { ZVAL_STR_COPY(EX_VAR(opline->result.var), op2_str); break; } } if (IS_CV != IS_CONST) { - if (UNEXPECTED(op2_str->len == 0)) { + if (UNEXPECTED(ZSTR_LEN(op2_str) == 0)) { ZVAL_STR_COPY(EX_VAR(opline->result.var), op1_str); break; @@ -35588,16 +35588,16 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_CV_CV_HANDLER(ZEND } if (IS_CV != IS_CONST && IS_CV != IS_CV && !ZSTR_IS_INTERNED(op1_str) && GC_REFCOUNT(op1_str) == 1) { - size_t len = op1_str->len; + size_t len = ZSTR_LEN(op1_str); - str = zend_string_realloc(op1_str, len + op2_str->len, 0); - memcpy(str->val + len, op2_str->val, op2_str->len+1); + str = zend_string_realloc(op1_str, len + ZSTR_LEN(op2_str), 0); + memcpy(ZSTR_VAL(str) + len, ZSTR_VAL(op2_str), ZSTR_LEN(op2_str)+1); ZVAL_NEW_STR(EX_VAR(opline->result.var), str); break; } else { - str = zend_string_alloc(op1_str->len + op2_str->len, 0); - memcpy(str->val, op1_str->val, op1_str->len); - memcpy(str->val + op1_str->len, op2_str->val, op2_str->len+1); + str = zend_string_alloc(ZSTR_LEN(op1_str) + ZSTR_LEN(op2_str), 0); + memcpy(ZSTR_VAL(str), ZSTR_VAL(op1_str), ZSTR_LEN(op1_str)); + memcpy(ZSTR_VAL(str) + ZSTR_LEN(op1_str), ZSTR_VAL(op2_str), ZSTR_LEN(op2_str)+1); ZVAL_NEW_STR(EX_VAR(opline->result.var), str); } } else { @@ -37220,7 +37220,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_CV_CV_HANDLER } do { if (IS_CV != IS_CONST) { - if (UNEXPECTED(op1_str->len == 0)) { + if (UNEXPECTED(ZSTR_LEN(op1_str) == 0)) { if (IS_CV == IS_CONST) { zend_string_addref(op2_str); } @@ -37230,7 +37230,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_CV_CV_HANDLER } } if (IS_CV != IS_CONST) { - if (UNEXPECTED(op2_str->len == 0)) { + if (UNEXPECTED(ZSTR_LEN(op2_str) == 0)) { if (IS_CV == IS_CONST) { zend_string_addref(op1_str); } @@ -37239,9 +37239,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_CV_CV_HANDLER break; } } - str = zend_string_alloc(op1_str->len + op2_str->len, 0); - memcpy(str->val, op1_str->val, op1_str->len); - memcpy(str->val + op1_str->len, op2_str->val, op2_str->len+1); + str = zend_string_alloc(ZSTR_LEN(op1_str) + ZSTR_LEN(op2_str), 0); + memcpy(ZSTR_VAL(str), ZSTR_VAL(op1_str), ZSTR_LEN(op1_str)); + memcpy(ZSTR_VAL(str) + ZSTR_LEN(op1_str), ZSTR_VAL(op2_str), ZSTR_LEN(op2_str)+1); ZVAL_NEW_STR(EX_VAR(opline->result.var), str); if (IS_CV != IS_CONST) { zend_string_release(op1_str); @@ -37343,7 +37343,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_CV_HA fbc = obj->handlers->get_method(&obj, Z_STR_P(function_name), ((IS_CV == IS_CONST) ? (EX_CONSTANT(opline->op2) + 1) : NULL)); if (UNEXPECTED(fbc == NULL)) { if (EXPECTED(!EG(exception))) { - zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", obj->ce->name->val, Z_STRVAL_P(function_name)); + zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(obj->ce->name), Z_STRVAL_P(function_name)); } @@ -38304,14 +38304,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_CV_TMPVAR_HANDLER( zend_string *str; if (IS_CV != IS_CONST) { - if (UNEXPECTED(op1_str->len == 0)) { + if (UNEXPECTED(ZSTR_LEN(op1_str) == 0)) { ZVAL_STR_COPY(EX_VAR(opline->result.var), op2_str); break; } } if ((IS_TMP_VAR|IS_VAR) != IS_CONST) { - if (UNEXPECTED(op2_str->len == 0)) { + if (UNEXPECTED(ZSTR_LEN(op2_str) == 0)) { ZVAL_STR_COPY(EX_VAR(opline->result.var), op1_str); break; @@ -38319,16 +38319,16 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_CV_TMPVAR_HANDLER( } if (IS_CV != IS_CONST && IS_CV != IS_CV && !ZSTR_IS_INTERNED(op1_str) && GC_REFCOUNT(op1_str) == 1) { - size_t len = op1_str->len; + size_t len = ZSTR_LEN(op1_str); - str = zend_string_realloc(op1_str, len + op2_str->len, 0); - memcpy(str->val + len, op2_str->val, op2_str->len+1); + str = zend_string_realloc(op1_str, len + ZSTR_LEN(op2_str), 0); + memcpy(ZSTR_VAL(str) + len, ZSTR_VAL(op2_str), ZSTR_LEN(op2_str)+1); ZVAL_NEW_STR(EX_VAR(opline->result.var), str); break; } else { - str = zend_string_alloc(op1_str->len + op2_str->len, 0); - memcpy(str->val, op1_str->val, op1_str->len); - memcpy(str->val + op1_str->len, op2_str->val, op2_str->len+1); + str = zend_string_alloc(ZSTR_LEN(op1_str) + ZSTR_LEN(op2_str), 0); + memcpy(ZSTR_VAL(str), ZSTR_VAL(op1_str), ZSTR_LEN(op1_str)); + memcpy(ZSTR_VAL(str) + ZSTR_LEN(op1_str), ZSTR_VAL(op2_str), ZSTR_LEN(op2_str)+1); ZVAL_NEW_STR(EX_VAR(opline->result.var), str); } } else { @@ -39826,7 +39826,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_CV_TMPVAR_HAN } do { if (IS_CV != IS_CONST) { - if (UNEXPECTED(op1_str->len == 0)) { + if (UNEXPECTED(ZSTR_LEN(op1_str) == 0)) { if ((IS_TMP_VAR|IS_VAR) == IS_CONST) { zend_string_addref(op2_str); } @@ -39836,7 +39836,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_CV_TMPVAR_HAN } } if ((IS_TMP_VAR|IS_VAR) != IS_CONST) { - if (UNEXPECTED(op2_str->len == 0)) { + if (UNEXPECTED(ZSTR_LEN(op2_str) == 0)) { if (IS_CV == IS_CONST) { zend_string_addref(op1_str); } @@ -39845,9 +39845,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_CV_TMPVAR_HAN break; } } - str = zend_string_alloc(op1_str->len + op2_str->len, 0); - memcpy(str->val, op1_str->val, op1_str->len); - memcpy(str->val + op1_str->len, op2_str->val, op2_str->len+1); + str = zend_string_alloc(ZSTR_LEN(op1_str) + ZSTR_LEN(op2_str), 0); + memcpy(ZSTR_VAL(str), ZSTR_VAL(op1_str), ZSTR_LEN(op1_str)); + memcpy(ZSTR_VAL(str) + ZSTR_LEN(op1_str), ZSTR_VAL(op2_str), ZSTR_LEN(op2_str)+1); ZVAL_NEW_STR(EX_VAR(opline->result.var), str); if (IS_CV != IS_CONST) { zend_string_release(op1_str); @@ -39949,7 +39949,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CV_TMPVA fbc = obj->handlers->get_method(&obj, Z_STR_P(function_name), (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? (EX_CONSTANT(opline->op2) + 1) : NULL)); if (UNEXPECTED(fbc == NULL)) { if (EXPECTED(!EG(exception))) { - zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", obj->ce->name->val, Z_STRVAL_P(function_name)); + zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(obj->ce->name), Z_STRVAL_P(function_name)); } zval_ptr_dtor_nogc(free_op2); @@ -40583,14 +40583,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ECHO_SPEC_TMPVAR_HANDLER(ZEND_ if (Z_TYPE_P(z) == IS_STRING) { zend_string *str = Z_STR_P(z); - if (str->len != 0) { - zend_write(str->val, str->len); + if (ZSTR_LEN(str) != 0) { + zend_write(ZSTR_VAL(str), ZSTR_LEN(str)); } } else { zend_string *str = _zval_get_string_func(z); - if (str->len != 0) { - zend_write(str->val, str->len); + if (ZSTR_LEN(str) != 0) { + zend_write(ZSTR_VAL(str), ZSTR_LEN(str)); } else if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_P(z) == IS_UNDEF)) { GET_OP1_UNDEF_CV(z, BP_VAR_R); } @@ -40894,7 +40894,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_TMPVAR_HANDLER(ZEND clone_call = Z_OBJ_HT_P(obj)->clone_obj; if (UNEXPECTED(clone_call == NULL)) { if (ce) { - zend_error(E_EXCEPTION | E_ERROR, "Trying to clone an uncloneable object of class %s", ce->name->val); + zend_error(E_EXCEPTION | E_ERROR, "Trying to clone an uncloneable object of class %s", ZSTR_VAL(ce->name)); } else { zend_error(E_EXCEPTION | E_ERROR, "Trying to clone an uncloneable object"); } @@ -40907,7 +40907,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_TMPVAR_HANDLER(ZEND /* Ensure that if we're calling a private function, we're allowed to do so. */ if (UNEXPECTED(ce != EG(scope))) { - zend_error(E_EXCEPTION | E_ERROR, "Call to private %s::__clone() from context '%s'", ce->name->val, EG(scope) ? EG(scope)->name->val : ""); + zend_error(E_EXCEPTION | E_ERROR, "Call to private %s::__clone() from context '%s'", ZSTR_VAL(ce->name), EG(scope) ? ZSTR_VAL(EG(scope)->name) : ""); zval_ptr_dtor_nogc(free_op1); HANDLE_EXCEPTION(); } @@ -40915,7 +40915,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_TMPVAR_HANDLER(ZEND /* Ensure that if we're calling a protected function, we're allowed to do so. */ if (UNEXPECTED(!zend_check_protected(zend_get_function_root_class(clone), EG(scope)))) { - zend_error(E_EXCEPTION | E_ERROR, "Call to protected %s::__clone() from context '%s'", ce->name->val, EG(scope) ? EG(scope)->name->val : ""); + zend_error(E_EXCEPTION | E_ERROR, "Call to protected %s::__clone() from context '%s'", ZSTR_VAL(ce->name), EG(scope) ? ZSTR_VAL(EG(scope)->name) : ""); zval_ptr_dtor_nogc(free_op1); HANDLE_EXCEPTION(); } @@ -40976,7 +40976,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_TMPVAR_HA if (failure_retval) { /* do nothing, file already included */ - } else if (SUCCESS == zend_stream_open(resolved_path->val, &file_handle)) { + } else if (SUCCESS == zend_stream_open(ZSTR_VAL(resolved_path), &file_handle)) { if (!file_handle.opened_path) { file_handle.opened_path = zend_string_copy(resolved_path); @@ -41122,7 +41122,7 @@ try_strlen: ZVAL_COPY(&tmp, value); if (zend_parse_arg_str_weak(&tmp, &str)) { - ZVAL_LONG(EX_VAR(opline->result.var), str->len); + ZVAL_LONG(EX_VAR(opline->result.var), ZSTR_LEN(str)); zval_ptr_dtor(&tmp); break; } @@ -41377,14 +41377,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_TMPVAR_CONST_HANDL zend_string *str; if ((IS_TMP_VAR|IS_VAR) != IS_CONST) { - if (UNEXPECTED(op1_str->len == 0)) { + if (UNEXPECTED(ZSTR_LEN(op1_str) == 0)) { ZVAL_STR_COPY(EX_VAR(opline->result.var), op2_str); zval_ptr_dtor_nogc(free_op1); break; } } if (IS_CONST != IS_CONST) { - if (UNEXPECTED(op2_str->len == 0)) { + if (UNEXPECTED(ZSTR_LEN(op2_str) == 0)) { ZVAL_STR_COPY(EX_VAR(opline->result.var), op1_str); zval_ptr_dtor_nogc(free_op1); break; @@ -41392,16 +41392,16 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_TMPVAR_CONST_HANDL } if ((IS_TMP_VAR|IS_VAR) != IS_CONST && (IS_TMP_VAR|IS_VAR) != IS_CV && !ZSTR_IS_INTERNED(op1_str) && GC_REFCOUNT(op1_str) == 1) { - size_t len = op1_str->len; + size_t len = ZSTR_LEN(op1_str); - str = zend_string_realloc(op1_str, len + op2_str->len, 0); - memcpy(str->val + len, op2_str->val, op2_str->len+1); + str = zend_string_realloc(op1_str, len + ZSTR_LEN(op2_str), 0); + memcpy(ZSTR_VAL(str) + len, ZSTR_VAL(op2_str), ZSTR_LEN(op2_str)+1); ZVAL_NEW_STR(EX_VAR(opline->result.var), str); break; } else { - str = zend_string_alloc(op1_str->len + op2_str->len, 0); - memcpy(str->val, op1_str->val, op1_str->len); - memcpy(str->val + op1_str->len, op2_str->val, op2_str->len+1); + str = zend_string_alloc(ZSTR_LEN(op1_str) + ZSTR_LEN(op2_str), 0); + memcpy(ZSTR_VAL(str), ZSTR_VAL(op1_str), ZSTR_LEN(op1_str)); + memcpy(ZSTR_VAL(str) + ZSTR_LEN(op1_str), ZSTR_VAL(op2_str), ZSTR_LEN(op2_str)+1); ZVAL_NEW_STR(EX_VAR(opline->result.var), str); } } else { @@ -41775,7 +41775,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_ /* check if static properties were destoyed */ if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) { - zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ce->name->val, name->val); + zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name)); zval_ptr_dtor_nogc(free_op1); HANDLE_EXCEPTION(); } @@ -41802,7 +41802,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_ /* check if static properties were destoyed */ if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) { - zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ce->name->val, name->val); + zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name)); zval_ptr_dtor_nogc(free_op1); HANDLE_EXCEPTION(); } @@ -41827,13 +41827,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_ switch (type) { case BP_VAR_R: case BP_VAR_UNSET: - zend_error(E_NOTICE,"Undefined variable: %s", name->val); + zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name)); /* break missing intentionally */ case BP_VAR_IS: retval = &EG(uninitialized_zval); break; case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined variable: %s", name->val); + zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name)); /* break missing intentionally */ case BP_VAR_W: retval = zend_hash_add_new(target_symbol_table, name, &EG(uninitialized_zval)); @@ -41847,13 +41847,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_ switch (type) { case BP_VAR_R: case BP_VAR_UNSET: - zend_error(E_NOTICE,"Undefined variable: %s", name->val); + zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name)); /* break missing intentionally */ case BP_VAR_IS: retval = &EG(uninitialized_zval); break; case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined variable: %s", name->val); + zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name)); /* break missing intentionally */ case BP_VAR_W: ZVAL_NULL(retval); @@ -42108,7 +42108,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_TMPVAR_CONST_ } do { if ((IS_TMP_VAR|IS_VAR) != IS_CONST) { - if (UNEXPECTED(op1_str->len == 0)) { + if (UNEXPECTED(ZSTR_LEN(op1_str) == 0)) { if (IS_CONST == IS_CONST) { zend_string_addref(op2_str); } @@ -42118,7 +42118,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_TMPVAR_CONST_ } } if (IS_CONST != IS_CONST) { - if (UNEXPECTED(op2_str->len == 0)) { + if (UNEXPECTED(ZSTR_LEN(op2_str) == 0)) { if ((IS_TMP_VAR|IS_VAR) == IS_CONST) { zend_string_addref(op1_str); } @@ -42127,9 +42127,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_TMPVAR_CONST_ break; } } - str = zend_string_alloc(op1_str->len + op2_str->len, 0); - memcpy(str->val, op1_str->val, op1_str->len); - memcpy(str->val + op1_str->len, op2_str->val, op2_str->len+1); + str = zend_string_alloc(ZSTR_LEN(op1_str) + ZSTR_LEN(op2_str), 0); + memcpy(ZSTR_VAL(str), ZSTR_VAL(op1_str), ZSTR_LEN(op1_str)); + memcpy(ZSTR_VAL(str) + ZSTR_LEN(op1_str), ZSTR_VAL(op2_str), ZSTR_LEN(op2_str)+1); ZVAL_NEW_STR(EX_VAR(opline->result.var), str); if ((IS_TMP_VAR|IS_VAR) != IS_CONST) { zend_string_release(op1_str); @@ -42231,7 +42231,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_C fbc = obj->handlers->get_method(&obj, Z_STR_P(function_name), ((IS_CONST == IS_CONST) ? (EX_CONSTANT(opline->op2) + 1) : NULL)); if (UNEXPECTED(fbc == NULL)) { if (EXPECTED(!EG(exception))) { - zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", obj->ce->name->val, Z_STRVAL_P(function_name)); + zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(obj->ce->name), Z_STRVAL_P(function_name)); } zval_ptr_dtor_nogc(free_op1); @@ -42803,7 +42803,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_ /* check if static properties were destoyed */ if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) { - zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ce->name->val, name->val); + zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name)); zval_ptr_dtor_nogc(free_op1); HANDLE_EXCEPTION(); } @@ -42830,7 +42830,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_ /* check if static properties were destoyed */ if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) { - zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ce->name->val, name->val); + zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name)); zval_ptr_dtor_nogc(free_op1); HANDLE_EXCEPTION(); } @@ -42855,13 +42855,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_ switch (type) { case BP_VAR_R: case BP_VAR_UNSET: - zend_error(E_NOTICE,"Undefined variable: %s", name->val); + zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name)); /* break missing intentionally */ case BP_VAR_IS: retval = &EG(uninitialized_zval); break; case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined variable: %s", name->val); + zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name)); /* break missing intentionally */ case BP_VAR_W: retval = zend_hash_add_new(target_symbol_table, name, &EG(uninitialized_zval)); @@ -42875,13 +42875,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_ switch (type) { case BP_VAR_R: case BP_VAR_UNSET: - zend_error(E_NOTICE,"Undefined variable: %s", name->val); + zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name)); /* break missing intentionally */ case BP_VAR_IS: retval = &EG(uninitialized_zval); break; case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined variable: %s", name->val); + zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name)); /* break missing intentionally */ case BP_VAR_W: ZVAL_NULL(retval); @@ -43226,7 +43226,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_ /* check if static properties were destoyed */ if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) { - zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ce->name->val, name->val); + zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name)); zval_ptr_dtor_nogc(free_op1); HANDLE_EXCEPTION(); } @@ -43253,7 +43253,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_ /* check if static properties were destoyed */ if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) { - zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ce->name->val, name->val); + zend_error(E_EXCEPTION | E_ERROR, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name)); zval_ptr_dtor_nogc(free_op1); HANDLE_EXCEPTION(); } @@ -43278,13 +43278,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_ switch (type) { case BP_VAR_R: case BP_VAR_UNSET: - zend_error(E_NOTICE,"Undefined variable: %s", name->val); + zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name)); /* break missing intentionally */ case BP_VAR_IS: retval = &EG(uninitialized_zval); break; case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined variable: %s", name->val); + zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name)); /* break missing intentionally */ case BP_VAR_W: retval = zend_hash_add_new(target_symbol_table, name, &EG(uninitialized_zval)); @@ -43298,13 +43298,13 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_ switch (type) { case BP_VAR_R: case BP_VAR_UNSET: - zend_error(E_NOTICE,"Undefined variable: %s", name->val); + zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name)); /* break missing intentionally */ case BP_VAR_IS: retval = &EG(uninitialized_zval); break; case BP_VAR_RW: - zend_error(E_NOTICE,"Undefined variable: %s", name->val); + zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name)); /* break missing intentionally */ case BP_VAR_W: ZVAL_NULL(retval); @@ -43807,14 +43807,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_TMPVAR_CV_HANDLER( zend_string *str; if ((IS_TMP_VAR|IS_VAR) != IS_CONST) { - if (UNEXPECTED(op1_str->len == 0)) { + if (UNEXPECTED(ZSTR_LEN(op1_str) == 0)) { ZVAL_STR_COPY(EX_VAR(opline->result.var), op2_str); zval_ptr_dtor_nogc(free_op1); break; } } if (IS_CV != IS_CONST) { - if (UNEXPECTED(op2_str->len == 0)) { + if (UNEXPECTED(ZSTR_LEN(op2_str) == 0)) { ZVAL_STR_COPY(EX_VAR(opline->result.var), op1_str); zval_ptr_dtor_nogc(free_op1); break; @@ -43822,16 +43822,16 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_TMPVAR_CV_HANDLER( } if ((IS_TMP_VAR|IS_VAR) != IS_CONST && (IS_TMP_VAR|IS_VAR) != IS_CV && !ZSTR_IS_INTERNED(op1_str) && GC_REFCOUNT(op1_str) == 1) { - size_t len = op1_str->len; + size_t len = ZSTR_LEN(op1_str); - str = zend_string_realloc(op1_str, len + op2_str->len, 0); - memcpy(str->val + len, op2_str->val, op2_str->len+1); + str = zend_string_realloc(op1_str, len + ZSTR_LEN(op2_str), 0); + memcpy(ZSTR_VAL(str) + len, ZSTR_VAL(op2_str), ZSTR_LEN(op2_str)+1); ZVAL_NEW_STR(EX_VAR(opline->result.var), str); break; } else { - str = zend_string_alloc(op1_str->len + op2_str->len, 0); - memcpy(str->val, op1_str->val, op1_str->len); - memcpy(str->val + op1_str->len, op2_str->val, op2_str->len+1); + str = zend_string_alloc(ZSTR_LEN(op1_str) + ZSTR_LEN(op2_str), 0); + memcpy(ZSTR_VAL(str), ZSTR_VAL(op1_str), ZSTR_LEN(op1_str)); + memcpy(ZSTR_VAL(str) + ZSTR_LEN(op1_str), ZSTR_VAL(op2_str), ZSTR_LEN(op2_str)+1); ZVAL_NEW_STR(EX_VAR(opline->result.var), str); } } else { @@ -44305,7 +44305,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_TMPVAR_CV_HAN } do { if ((IS_TMP_VAR|IS_VAR) != IS_CONST) { - if (UNEXPECTED(op1_str->len == 0)) { + if (UNEXPECTED(ZSTR_LEN(op1_str) == 0)) { if (IS_CV == IS_CONST) { zend_string_addref(op2_str); } @@ -44315,7 +44315,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_TMPVAR_CV_HAN } } if (IS_CV != IS_CONST) { - if (UNEXPECTED(op2_str->len == 0)) { + if (UNEXPECTED(ZSTR_LEN(op2_str) == 0)) { if ((IS_TMP_VAR|IS_VAR) == IS_CONST) { zend_string_addref(op1_str); } @@ -44324,9 +44324,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_TMPVAR_CV_HAN break; } } - str = zend_string_alloc(op1_str->len + op2_str->len, 0); - memcpy(str->val, op1_str->val, op1_str->len); - memcpy(str->val + op1_str->len, op2_str->val, op2_str->len+1); + str = zend_string_alloc(ZSTR_LEN(op1_str) + ZSTR_LEN(op2_str), 0); + memcpy(ZSTR_VAL(str), ZSTR_VAL(op1_str), ZSTR_LEN(op1_str)); + memcpy(ZSTR_VAL(str) + ZSTR_LEN(op1_str), ZSTR_VAL(op2_str), ZSTR_LEN(op2_str)+1); ZVAL_NEW_STR(EX_VAR(opline->result.var), str); if ((IS_TMP_VAR|IS_VAR) != IS_CONST) { zend_string_release(op1_str); @@ -44428,7 +44428,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_C fbc = obj->handlers->get_method(&obj, Z_STR_P(function_name), ((IS_CV == IS_CONST) ? (EX_CONSTANT(opline->op2) + 1) : NULL)); if (UNEXPECTED(fbc == NULL)) { if (EXPECTED(!EG(exception))) { - zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", obj->ce->name->val, Z_STRVAL_P(function_name)); + zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(obj->ce->name), Z_STRVAL_P(function_name)); } zval_ptr_dtor_nogc(free_op1); @@ -44970,14 +44970,14 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_TMPVAR_TMPVAR_HAND zend_string *str; if ((IS_TMP_VAR|IS_VAR) != IS_CONST) { - if (UNEXPECTED(op1_str->len == 0)) { + if (UNEXPECTED(ZSTR_LEN(op1_str) == 0)) { ZVAL_STR_COPY(EX_VAR(opline->result.var), op2_str); zval_ptr_dtor_nogc(free_op1); break; } } if ((IS_TMP_VAR|IS_VAR) != IS_CONST) { - if (UNEXPECTED(op2_str->len == 0)) { + if (UNEXPECTED(ZSTR_LEN(op2_str) == 0)) { ZVAL_STR_COPY(EX_VAR(opline->result.var), op1_str); zval_ptr_dtor_nogc(free_op1); break; @@ -44985,16 +44985,16 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_TMPVAR_TMPVAR_HAND } if ((IS_TMP_VAR|IS_VAR) != IS_CONST && (IS_TMP_VAR|IS_VAR) != IS_CV && !ZSTR_IS_INTERNED(op1_str) && GC_REFCOUNT(op1_str) == 1) { - size_t len = op1_str->len; + size_t len = ZSTR_LEN(op1_str); - str = zend_string_realloc(op1_str, len + op2_str->len, 0); - memcpy(str->val + len, op2_str->val, op2_str->len+1); + str = zend_string_realloc(op1_str, len + ZSTR_LEN(op2_str), 0); + memcpy(ZSTR_VAL(str) + len, ZSTR_VAL(op2_str), ZSTR_LEN(op2_str)+1); ZVAL_NEW_STR(EX_VAR(opline->result.var), str); break; } else { - str = zend_string_alloc(op1_str->len + op2_str->len, 0); - memcpy(str->val, op1_str->val, op1_str->len); - memcpy(str->val + op1_str->len, op2_str->val, op2_str->len+1); + str = zend_string_alloc(ZSTR_LEN(op1_str) + ZSTR_LEN(op2_str), 0); + memcpy(ZSTR_VAL(str), ZSTR_VAL(op1_str), ZSTR_LEN(op1_str)); + memcpy(ZSTR_VAL(str) + ZSTR_LEN(op1_str), ZSTR_VAL(op2_str), ZSTR_LEN(op2_str)+1); ZVAL_NEW_STR(EX_VAR(opline->result.var), str); } } else { @@ -45469,7 +45469,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_TMPVAR_TMPVAR } do { if ((IS_TMP_VAR|IS_VAR) != IS_CONST) { - if (UNEXPECTED(op1_str->len == 0)) { + if (UNEXPECTED(ZSTR_LEN(op1_str) == 0)) { if ((IS_TMP_VAR|IS_VAR) == IS_CONST) { zend_string_addref(op2_str); } @@ -45479,7 +45479,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_TMPVAR_TMPVAR } } if ((IS_TMP_VAR|IS_VAR) != IS_CONST) { - if (UNEXPECTED(op2_str->len == 0)) { + if (UNEXPECTED(ZSTR_LEN(op2_str) == 0)) { if ((IS_TMP_VAR|IS_VAR) == IS_CONST) { zend_string_addref(op1_str); } @@ -45488,9 +45488,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_TMPVAR_TMPVAR break; } } - str = zend_string_alloc(op1_str->len + op2_str->len, 0); - memcpy(str->val, op1_str->val, op1_str->len); - memcpy(str->val + op1_str->len, op2_str->val, op2_str->len+1); + str = zend_string_alloc(ZSTR_LEN(op1_str) + ZSTR_LEN(op2_str), 0); + memcpy(ZSTR_VAL(str), ZSTR_VAL(op1_str), ZSTR_LEN(op1_str)); + memcpy(ZSTR_VAL(str) + ZSTR_LEN(op1_str), ZSTR_VAL(op2_str), ZSTR_LEN(op2_str)+1); ZVAL_NEW_STR(EX_VAR(opline->result.var), str); if ((IS_TMP_VAR|IS_VAR) != IS_CONST) { zend_string_release(op1_str); @@ -45592,7 +45592,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_TMPVAR_T fbc = obj->handlers->get_method(&obj, Z_STR_P(function_name), (((IS_TMP_VAR|IS_VAR) == IS_CONST) ? (EX_CONSTANT(opline->op2) + 1) : NULL)); if (UNEXPECTED(fbc == NULL)) { if (EXPECTED(!EG(exception))) { - zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", obj->ce->name->val, Z_STRVAL_P(function_name)); + zend_error(E_EXCEPTION | E_ERROR, "Call to undefined method %s::%s()", ZSTR_VAL(obj->ce->name), Z_STRVAL_P(function_name)); } zval_ptr_dtor_nogc(free_op2); zval_ptr_dtor_nogc(free_op1); diff --git a/ext/dba/dba.c b/ext/dba/dba.c index eb9edbb741..5b73c7d3fb 100644 --- a/ext/dba/dba.c +++ b/ext/dba/dba.c @@ -480,15 +480,15 @@ ZEND_INI_MH(OnUpdateDefaultHandler) { dba_handler *hptr; - if (!new_value->len) { + if (!ZSTR_LEN(new_value)) { DBA_G(default_hptr) = NULL; return OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage); } - for (hptr = handler; hptr->name && strcasecmp(hptr->name, new_value->val); hptr++); + for (hptr = handler; hptr->name && strcasecmp(hptr->name, ZSTR_VAL(new_value)); hptr++); if (!hptr->name) { - php_error_docref(NULL, E_WARNING, "No such handler: %s", new_value->val); + php_error_docref(NULL, E_WARNING, "No such handler: %s", ZSTR_VAL(new_value)); return FAILURE; } DBA_G(default_hptr) = hptr; @@ -547,7 +547,7 @@ PHP_MINFO_FUNCTION(dba) php_info_print_table_row(2, "DBA support", "enabled"); if (handlers.s) { smart_str_0(&handlers); - php_info_print_table_row(2, "Supported handlers", handlers.s->val); + php_info_print_table_row(2, "Supported handlers", ZSTR_VAL(handlers.s)); smart_str_free(&handlers); } else { php_info_print_table_row(2, "Supported handlers", "none"); @@ -862,7 +862,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) lock_file_mode = "a+b"; } else { if (opened_path) { - info->lock.name = pestrndup(opened_path->val, opened_path->len, persistent); + info->lock.name = pestrndup(ZSTR_VAL(opened_path), ZSTR_LEN(opened_path), persistent); zend_string_release(opened_path); } } @@ -873,10 +873,10 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) if (lock_dbf) { /* replace the path info with the real path of the opened file */ pefree(info->path, persistent); - info->path = pestrndup(opened_path->val, opened_path->len, persistent); + info->path = pestrndup(ZSTR_VAL(opened_path), ZSTR_LEN(opened_path), persistent); } /* now store the name of the lock */ - info->lock.name = pestrndup(opened_path->val, opened_path->len, persistent); + info->lock.name = pestrndup(ZSTR_VAL(opened_path), ZSTR_LEN(opened_path), persistent); zend_string_release(opened_path); } } diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c index 55b1bac904..841143f5b3 100644 --- a/ext/imap/php_imap.c +++ b/ext/imap/php_imap.c @@ -1215,12 +1215,12 @@ static void php_imap_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) } /* local filename, need to perform open_basedir check */ - if (mailbox->val[0] != '{' && php_check_open_basedir(mailbox->val)) { + if (ZSTR_VAL(mailbox)[0] != '{' && php_check_open_basedir(ZSTR_VAL(mailbox))) { RETURN_FALSE; } - IMAPG(imap_user) = estrndup(user->val, user->len); - IMAPG(imap_password) = estrndup(passwd->val, passwd->len); + IMAPG(imap_user) = estrndup(ZSTR_VAL(user), ZSTR_LEN(user)); + IMAPG(imap_password) = estrndup(ZSTR_VAL(passwd), ZSTR_LEN(passwd)); #ifdef SET_MAXLOGINTRIALS if (argc >= 5) { @@ -1232,10 +1232,10 @@ static void php_imap_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) } #endif - imap_stream = mail_open(NIL, mailbox->val, flags); + imap_stream = mail_open(NIL, ZSTR_VAL(mailbox), flags); if (imap_stream == NIL) { - php_error_docref(NULL, E_WARNING, "Couldn't open stream %s", mailbox->val); + php_error_docref(NULL, E_WARNING, "Couldn't open stream %s", ZSTR_VAL(mailbox)); efree(IMAPG(imap_user)); IMAPG(imap_user) = 0; efree(IMAPG(imap_password)); IMAPG(imap_password) = 0; RETURN_FALSE; @@ -1290,11 +1290,11 @@ PHP_FUNCTION(imap_reopen) } #endif /* local filename, need to perform open_basedir check */ - if (mailbox->val[0] != '{' && php_check_open_basedir(mailbox->val)) { + if (ZSTR_VAL(mailbox)[0] != '{' && php_check_open_basedir(ZSTR_VAL(mailbox))) { RETURN_FALSE; } - imap_le_struct->imap_stream = mail_open(imap_le_struct->imap_stream, mailbox->val, flags); + imap_le_struct->imap_stream = mail_open(imap_le_struct->imap_stream, ZSTR_VAL(mailbox), flags); if (imap_le_struct->imap_stream == NIL) { zend_list_delete(Z_RES_P(streamind)); php_error_docref(NULL, E_WARNING, "Couldn't re-open stream"); @@ -1333,7 +1333,7 @@ PHP_FUNCTION(imap_append) } zend_string_free(regex); - php_pcre_match_impl(pce, internal_date->val, internal_date->len, return_value, subpats, global, + php_pcre_match_impl(pce, ZSTR_VAL(internal_date), ZSTR_LEN(internal_date), return_value, subpats, global, 0, regex_flags, start_offset); if (!Z_LVAL_P(return_value)) { @@ -1347,9 +1347,9 @@ PHP_FUNCTION(imap_append) RETURN_FALSE; } - INIT (&st, mail_string, (void *) message->val, message->len); + INIT (&st, mail_string, (void *) ZSTR_VAL(message), ZSTR_LEN(message)); - if (mail_append_full(imap_le_struct->imap_stream, folder->val, (flags ? flags->val : NIL), (internal_date ? internal_date->val : NIL), &st)) { + if (mail_append_full(imap_le_struct->imap_stream, ZSTR_VAL(folder), (flags ? ZSTR_VAL(flags) : NIL), (internal_date ? ZSTR_VAL(internal_date) : NIL), &st)) { RETURN_TRUE; } else { RETURN_FALSE; @@ -1436,7 +1436,7 @@ PHP_FUNCTION(imap_get_quota) /* set the callback for the GET_QUOTA function */ mail_parameters(NIL, SET_QUOTA, (void *) mail_getquota); - if (!imap_getquota(imap_le_struct->imap_stream, qroot->val)) { + if (!imap_getquota(imap_le_struct->imap_stream, ZSTR_VAL(qroot))) { php_error_docref(NULL, E_WARNING, "c-client imap_getquota failed"); zval_dtor(return_value); RETURN_FALSE; @@ -1465,7 +1465,7 @@ PHP_FUNCTION(imap_get_quotaroot) /* set the callback for the GET_QUOTAROOT function */ mail_parameters(NIL, SET_QUOTA, (void *) mail_getquota); - if (!imap_getquotaroot(imap_le_struct->imap_stream, mbox->val)) { + if (!imap_getquotaroot(imap_le_struct->imap_stream, ZSTR_VAL(mbox))) { php_error_docref(NULL, E_WARNING, "c-client imap_getquotaroot failed"); zval_dtor(return_value); RETURN_FALSE; @@ -1495,7 +1495,7 @@ PHP_FUNCTION(imap_set_quota) limits.text.size = mailbox_size; limits.next = NIL; - RETURN_BOOL(imap_setquota(imap_le_struct->imap_stream, qroot->val, &limits)); + RETURN_BOOL(imap_setquota(imap_le_struct->imap_stream, ZSTR_VAL(qroot), &limits)); } /* }}} */ @@ -1515,7 +1515,7 @@ PHP_FUNCTION(imap_setacl) RETURN_FALSE; } - RETURN_BOOL(imap_setacl(imap_le_struct->imap_stream, mailbox->val, id->val, rights->val)); + RETURN_BOOL(imap_setacl(imap_le_struct->imap_stream, ZSTR_VAL(mailbox), ZSTR_VAL(id), ZSTR_VAL(rights))); } /* }}} */ @@ -1542,7 +1542,7 @@ PHP_FUNCTION(imap_getacl) /* set the callback for the GET_ACL function */ mail_parameters(NIL, SET_ACL, (void *) mail_getacl); - if (!imap_getacl(imap_le_struct->imap_stream, mailbox->val)) { + if (!imap_getacl(imap_le_struct->imap_stream, ZSTR_VAL(mailbox))) { php_error(E_WARNING, "c-client imap_getacl failed"); zval_dtor(return_value); RETURN_FALSE; @@ -1757,7 +1757,7 @@ PHP_FUNCTION(imap_mail_copy) RETURN_FALSE; } - if (mail_copy_full(imap_le_struct->imap_stream, seq->val, folder->val, (argc == 4 ? options : NIL)) == T) { + if (mail_copy_full(imap_le_struct->imap_stream, ZSTR_VAL(seq), ZSTR_VAL(folder), (argc == 4 ? options : NIL)) == T) { RETURN_TRUE; } else { RETURN_FALSE; @@ -1783,7 +1783,7 @@ PHP_FUNCTION(imap_mail_move) RETURN_FALSE; } - if (mail_copy_full(imap_le_struct->imap_stream, seq->val, folder->val, (argc == 4 ? (options | CP_MOVE) : CP_MOVE)) == T) { + if (mail_copy_full(imap_le_struct->imap_stream, ZSTR_VAL(seq), ZSTR_VAL(folder), (argc == 4 ? (options | CP_MOVE) : CP_MOVE)) == T) { RETURN_TRUE; } else { RETURN_FALSE; @@ -1807,7 +1807,7 @@ PHP_FUNCTION(imap_createmailbox) RETURN_FALSE; } - if (mail_create(imap_le_struct->imap_stream, folder->val) == T) { + if (mail_create(imap_le_struct->imap_stream, ZSTR_VAL(folder)) == T) { RETURN_TRUE; } else { RETURN_FALSE; @@ -1831,7 +1831,7 @@ PHP_FUNCTION(imap_renamemailbox) RETURN_FALSE; } - if (mail_rename(imap_le_struct->imap_stream, old_mailbox->val, new_mailbox->val) == T) { + if (mail_rename(imap_le_struct->imap_stream, ZSTR_VAL(old_mailbox), ZSTR_VAL(new_mailbox)) == T) { RETURN_TRUE; } else { RETURN_FALSE; @@ -1855,7 +1855,7 @@ PHP_FUNCTION(imap_deletemailbox) RETURN_FALSE; } - if (mail_delete(imap_le_struct->imap_stream, folder->val) == T) { + if (mail_delete(imap_le_struct->imap_stream, ZSTR_VAL(folder)) == T) { RETURN_TRUE; } else { RETURN_FALSE; @@ -1884,7 +1884,7 @@ PHP_FUNCTION(imap_list) IMAPG(folderlist_style) = FLIST_ARRAY; IMAPG(imap_folders) = IMAPG(imap_folders_tail) = NIL; - mail_list(imap_le_struct->imap_stream, ref->val, pat->val); + mail_list(imap_le_struct->imap_stream, ZSTR_VAL(ref), ZSTR_VAL(pat)); if (IMAPG(imap_folders) == NIL) { RETURN_FALSE; } @@ -1924,7 +1924,7 @@ PHP_FUNCTION(imap_list_full) IMAPG(folderlist_style) = FLIST_OBJECT; IMAPG(imap_folder_objects) = IMAPG(imap_folder_objects_tail) = NIL; - mail_list(imap_le_struct->imap_stream, ref->val, pat->val); + mail_list(imap_le_struct->imap_stream, ZSTR_VAL(ref), ZSTR_VAL(pat)); if (IMAPG(imap_folder_objects) == NIL) { RETURN_FALSE; } @@ -1970,7 +1970,7 @@ PHP_FUNCTION(imap_listscan) } IMAPG(imap_folders) = NIL; - mail_scan(imap_le_struct->imap_stream, ref->val, pat->val, content->val); + mail_scan(imap_le_struct->imap_stream, ZSTR_VAL(ref), ZSTR_VAL(pat), ZSTR_VAL(content)); if (IMAPG(imap_folders) == NIL) { RETURN_FALSE; } @@ -2167,9 +2167,9 @@ PHP_FUNCTION(imap_rfc822_parse_headers) } if (argc == 2) { - rfc822_parse_msg(&en, NULL, headers->val, headers->len, NULL, defaulthost->val, NIL); + rfc822_parse_msg(&en, NULL, ZSTR_VAL(headers), ZSTR_LEN(headers), NULL, ZSTR_VAL(defaulthost), NIL); } else { - rfc822_parse_msg(&en, NULL, headers->val, headers->len, NULL, "UNKNOWN", NIL); + rfc822_parse_msg(&en, NULL, ZSTR_VAL(headers), ZSTR_LEN(headers), NULL, "UNKNOWN", NIL); } /* call a function to parse all the text, so that we can use the @@ -2201,7 +2201,7 @@ PHP_FUNCTION(imap_lsub) IMAPG(folderlist_style) = FLIST_ARRAY; IMAPG(imap_sfolders) = NIL; - mail_lsub(imap_le_struct->imap_stream, ref->val, pat->val); + mail_lsub(imap_le_struct->imap_stream, ZSTR_VAL(ref), ZSTR_VAL(pat)); if (IMAPG(imap_sfolders) == NIL) { RETURN_FALSE; } @@ -2240,7 +2240,7 @@ PHP_FUNCTION(imap_lsub_full) IMAPG(folderlist_style) = FLIST_OBJECT; IMAPG(imap_sfolder_objects) = IMAPG(imap_sfolder_objects_tail) = NIL; - mail_lsub(imap_le_struct->imap_stream, ref->val, pat->val); + mail_lsub(imap_le_struct->imap_stream, ZSTR_VAL(ref), ZSTR_VAL(pat)); if (IMAPG(imap_sfolder_objects) == NIL) { RETURN_FALSE; } @@ -2284,7 +2284,7 @@ PHP_FUNCTION(imap_subscribe) RETURN_FALSE; } - if (mail_subscribe(imap_le_struct->imap_stream, folder->val) == T) { + if (mail_subscribe(imap_le_struct->imap_stream, ZSTR_VAL(folder)) == T) { RETURN_TRUE; } else { RETURN_FALSE; @@ -2308,7 +2308,7 @@ PHP_FUNCTION(imap_unsubscribe) RETURN_FALSE; } - if (mail_unsubscribe(imap_le_struct->imap_stream, folder->val) == T) { + if (mail_unsubscribe(imap_le_struct->imap_stream, ZSTR_VAL(folder)) == T) { RETURN_TRUE; } else { RETURN_FALSE; @@ -2396,7 +2396,7 @@ PHP_FUNCTION(imap_fetchbody) PHP_IMAP_CHECK_MSGNO(msgno); } - body = mail_fetchbody_full(imap_le_struct->imap_stream, msgno, sec->val, &len, (argc == 4 ? flags : NIL)); + body = mail_fetchbody_full(imap_le_struct->imap_stream, msgno, ZSTR_VAL(sec), &len, (argc == 4 ? flags : NIL)); if (!body) { php_error_docref(NULL, E_WARNING, "No body information available"); @@ -2438,7 +2438,7 @@ PHP_FUNCTION(imap_fetchmime) PHP_IMAP_CHECK_MSGNO(msgno); } - body = mail_fetch_mime(imap_le_struct->imap_stream, msgno, sec->val, &len, (argc == 4 ? flags : NIL)); + body = mail_fetch_mime(imap_le_struct->imap_stream, msgno, ZSTR_VAL(sec), &len, (argc == 4 ? flags : NIL)); if (!body) { php_error_docref(NULL, E_WARNING, "No body MIME information available"); @@ -2492,7 +2492,7 @@ PHP_FUNCTION(imap_savebody) IMAPG(gets_stream) = writer; mail_parameters(NIL, SET_GETS, (void *) php_mail_gets); - mail_fetchbody_full(imap_ptr->imap_stream, msgno, section?section->val:"", NULL, flags); + mail_fetchbody_full(imap_ptr->imap_stream, msgno, section?ZSTR_VAL(section):"", NULL, flags); mail_parameters(NIL, SET_GETS, (void *) NULL); IMAPG(gets_stream) = NULL; @@ -2516,7 +2516,7 @@ PHP_FUNCTION(imap_base64) return; } - decode = (char *) rfc822_base64((unsigned char *) text->val, text->len, &newlength); + decode = (char *) rfc822_base64((unsigned char *) ZSTR_VAL(text), ZSTR_LEN(text), &newlength); if (decode == NULL) { RETURN_FALSE; @@ -2539,7 +2539,7 @@ PHP_FUNCTION(imap_qprint) return; } - decode = (char *) rfc822_qprint((unsigned char *) text->val, text->len, &newlength); + decode = (char *) rfc822_qprint((unsigned char *) ZSTR_VAL(text), ZSTR_LEN(text), &newlength); if (decode == NULL) { RETURN_FALSE; @@ -2562,7 +2562,7 @@ PHP_FUNCTION(imap_8bit) return; } - decode = (char *) rfc822_8bit((unsigned char *) text->val, text->len, &newlength); + decode = (char *) rfc822_8bit((unsigned char *) ZSTR_VAL(text), ZSTR_LEN(text), &newlength); if (decode == NULL) { RETURN_FALSE; @@ -2585,7 +2585,7 @@ PHP_FUNCTION(imap_binary) return; } - decode = (char*)rfc822_binary(text->val, text->len, &newlength); + decode = (char*)rfc822_binary(ZSTR_VAL(text), ZSTR_LEN(text), &newlength); if (decode == NULL) { RETURN_FALSE; @@ -2660,15 +2660,15 @@ PHP_FUNCTION(imap_rfc822_write_address) addr=mail_newaddr(); if (mailbox) { - addr->mailbox = cpystr(mailbox->val); + addr->mailbox = cpystr(ZSTR_VAL(mailbox)); } if (host) { - addr->host = cpystr(host->val); + addr->host = cpystr(ZSTR_VAL(host)); } if (personal) { - addr->personal = cpystr(personal->val); + addr->personal = cpystr(ZSTR_VAL(personal)); } addr->next=NIL; @@ -2701,8 +2701,8 @@ PHP_FUNCTION(imap_rfc822_parse_adrlist) env = mail_newenvelope(); /* rfc822_parse_adrlist() modifies passed string. Copy it. */ - str_copy = estrndup(str->val, str->len); - rfc822_parse_adrlist(&env->to, str_copy, defaulthost->val); + str_copy = estrndup(ZSTR_VAL(str), ZSTR_LEN(str)); + rfc822_parse_adrlist(&env->to, str_copy, ZSTR_VAL(defaulthost)); efree(str_copy); array_init(return_value); @@ -2746,7 +2746,7 @@ PHP_FUNCTION(imap_utf8) dest.data = NULL; dest.size = 0; - cpytxt(&src, str->val, str->len); + cpytxt(&src, ZSTR_VAL(str), ZSTR_LEN(str)); #ifndef HAVE_NEW_MIME2TEXT utf8_mime2text(&src, &dest); @@ -2805,8 +2805,8 @@ PHP_FUNCTION(imap_utf7_decode) return; } - in = (const unsigned char *) arg->val; - inlen = arg->len; + in = (const unsigned char *) ZSTR_VAL(arg); + inlen = ZSTR_LEN(arg); /* validate and compute length of output string */ outlen = 0; @@ -2944,8 +2944,8 @@ PHP_FUNCTION(imap_utf7_encode) return; } - in = (const unsigned char *) arg->val; - inlen = arg->len; + in = (const unsigned char *) ZSTR_VAL(arg); + inlen = ZSTR_LEN(arg); /* compute the length of the result string */ outlen = 0; @@ -2982,7 +2982,7 @@ PHP_FUNCTION(imap_utf7_encode) out = zend_string_alloc(outlen, 0); /* encode input string */ - outp = (unsigned char*)out->val; + outp = (unsigned char*)ZSTR_VAL(out); state = ST_NORMAL; endp = (inp = in) + inlen; while (inp < endp || state != ST_NORMAL) { @@ -3048,14 +3048,14 @@ static void php_imap_mutf7(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */ return; } - if (in->len < 1) { + if (ZSTR_LEN(in) < 1) { RETURN_EMPTY_STRING(); } if (mode == 0) { - out = utf8_to_mutf7((unsigned char *) in->val); + out = utf8_to_mutf7((unsigned char *) ZSTR_VAL(in)); } else { - out = utf8_from_mutf7((unsigned char *) in->val); + out = utf8_from_mutf7((unsigned char *) ZSTR_VAL(in)); } if (out == NIL) { @@ -3100,7 +3100,7 @@ PHP_FUNCTION(imap_setflag_full) RETURN_FALSE; } - mail_setflag_full(imap_le_struct->imap_stream, sequence->val, flag->val, (flags ? flags : NIL)); + mail_setflag_full(imap_le_struct->imap_stream, ZSTR_VAL(sequence), ZSTR_VAL(flag), (flags ? flags : NIL)); RETURN_TRUE; } /* }}} */ @@ -3123,7 +3123,7 @@ PHP_FUNCTION(imap_clearflag_full) RETURN_FALSE; } - mail_clearflag_full(imap_le_struct->imap_stream, sequence->val, flag->val, (argc == 4 ? flags : NIL)); + mail_clearflag_full(imap_le_struct->imap_stream, ZSTR_VAL(sequence), ZSTR_VAL(flag), (argc == 4 ? flags : NIL)); RETURN_TRUE; } /* }}} */ @@ -3161,7 +3161,7 @@ PHP_FUNCTION(imap_sort) } } if (argc >= 5) { - search_criteria = estrndup(criteria->val, criteria->len); + search_criteria = estrndup(ZSTR_VAL(criteria), ZSTR_LEN(criteria)); spg = mail_criteria(search_criteria); efree(search_criteria); } else { @@ -3173,7 +3173,7 @@ PHP_FUNCTION(imap_sort) mypgm->function = (short) pgm; mypgm->next = NIL; - slst = mail_sort(imap_le_struct->imap_stream, (argc == 6 ? charset->val : NIL), spg, mypgm, (argc >= 4 ? flags : NIL)); + slst = mail_sort(imap_le_struct->imap_stream, (argc == 6 ? ZSTR_VAL(charset) : NIL), spg, mypgm, (argc >= 4 ? flags : NIL)); if (spg && !(flags & SE_FREE)) { mail_free_searchpgm(&spg); @@ -3292,7 +3292,7 @@ PHP_FUNCTION(imap_status) object_init(return_value); - if (mail_status(imap_le_struct->imap_stream, mbx->val, flags)) { + if (mail_status(imap_le_struct->imap_stream, ZSTR_VAL(mbx), flags)) { add_property_long(return_value, "flags", IMAPG(status_flags)); if (IMAPG(status_flags) & SA_MESSAGES) { add_property_long(return_value, "messages", IMAPG(status_messages)); @@ -3342,7 +3342,7 @@ PHP_FUNCTION(imap_bodystruct) object_init(return_value); - body=mail_body(imap_le_struct->imap_stream, msg, (unsigned char*)section->val); + body=mail_body(imap_le_struct->imap_stream, msg, (unsigned char*)ZSTR_VAL(section)); if (body == NULL) { zval_dtor(return_value); RETURN_FALSE; @@ -3456,8 +3456,8 @@ PHP_FUNCTION(imap_fetch_overview) array_init(return_value); status = (flags & FT_UID) - ? mail_uid_sequence(imap_le_struct->imap_stream, (unsigned char*)sequence->val) - : mail_sequence(imap_le_struct->imap_stream, (unsigned char*)sequence->val); + ? mail_uid_sequence(imap_le_struct->imap_stream, (unsigned char*)ZSTR_VAL(sequence)) + : mail_sequence(imap_le_struct->imap_stream, (unsigned char*)ZSTR_VAL(sequence)); if (status) { MESSAGECACHE *elt; @@ -3634,7 +3634,7 @@ PHP_FUNCTION(imap_mail_compose) disp_param = tmp_param = NULL; ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(pvalue), key, disp_data) { disp_param = mail_newbody_parameter(); - disp_param->attribute = cpystr(key->val); + disp_param->attribute = cpystr(ZSTR_VAL(key)); convert_to_string_ex(disp_data); disp_param->value = (char *) fs_get(Z_STRLEN_P(disp_data) + 1); memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRLEN_P(disp_data) + 1); @@ -3666,7 +3666,7 @@ PHP_FUNCTION(imap_mail_compose) disp_param = tmp_param = NULL; ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(pvalue), key, disp_data) { disp_param = mail_newbody_parameter(); - disp_param->attribute = cpystr(key->val); + disp_param->attribute = cpystr(ZSTR_VAL(key)); convert_to_string_ex(disp_data); disp_param->value = (char *) fs_get(Z_STRLEN_P(disp_data) + 1); memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRLEN_P(disp_data) + 1); @@ -3738,7 +3738,7 @@ PHP_FUNCTION(imap_mail_compose) disp_param = tmp_param = NULL; ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(pvalue), key, disp_data) { disp_param = mail_newbody_parameter(); - disp_param->attribute = cpystr(key->val); + disp_param->attribute = cpystr(ZSTR_VAL(key)); convert_to_string_ex(disp_data); disp_param->value = (char *)fs_get(Z_STRLEN_P(disp_data) + 1); memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRLEN_P(disp_data) + 1); @@ -3770,7 +3770,7 @@ PHP_FUNCTION(imap_mail_compose) disp_param = tmp_param = NULL; ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(pvalue), key, disp_data) { disp_param = mail_newbody_parameter(); - disp_param->attribute = cpystr(key->val); + disp_param->attribute = cpystr(ZSTR_VAL(key)); convert_to_string_ex(disp_data); disp_param->value = (char *) fs_get(Z_STRLEN_P(disp_data) + 1); memcpy(disp_param->value, Z_STRVAL_P(disp_data), Z_STRLEN_P(disp_data) + 1); @@ -4096,26 +4096,26 @@ PHP_FUNCTION(imap_mail) } /* To: */ - if (!to->len) { + if (!ZSTR_LEN(to)) { php_error_docref(NULL, E_WARNING, "No to field in mail command"); RETURN_FALSE; } /* Subject: */ - if (!subject->len) { + if (!ZSTR_LEN(subject)) { php_error_docref(NULL, E_WARNING, "No subject field in mail command"); RETURN_FALSE; } /* message body */ - if (!message->len) { + if (!ZSTR_LEN(message)) { /* this is not really an error, so it is allowed. */ php_error_docref(NULL, E_WARNING, "No message string in mail command"); message = NULL; } - if (_php_imap_mail(to->val, subject->val, message->val, headers?headers->val:NULL, cc?cc->val:NULL, - bcc?bcc->val:NULL, rpath?rpath->val:NULL)) { + if (_php_imap_mail(ZSTR_VAL(to), ZSTR_VAL(subject), ZSTR_VAL(message), headers?ZSTR_VAL(headers):NULL, cc?ZSTR_VAL(cc):NULL, + bcc?ZSTR_VAL(bcc):NULL, rpath?ZSTR_VAL(rpath):NULL)) { RETURN_TRUE; } else { RETURN_FALSE; @@ -4144,12 +4144,12 @@ PHP_FUNCTION(imap_search) RETURN_FALSE; } - search_criteria = estrndup(criteria->val, criteria->len); + search_criteria = estrndup(ZSTR_VAL(criteria), ZSTR_LEN(criteria)); IMAPG(imap_messages) = IMAPG(imap_messages_tail) = NIL; pgm = mail_criteria(search_criteria); - mail_search_full(imap_le_struct->imap_stream, (argc == 4 ? charset->val : NIL), pgm, flags); + mail_search_full(imap_le_struct->imap_stream, (argc == 4 ? ZSTR_VAL(charset) : NIL), pgm, flags); if (pgm && !(flags & SE_FREE)) { mail_free_searchpgm(&pgm); @@ -4268,8 +4268,8 @@ PHP_FUNCTION(imap_mime_header_decode) array_init(return_value); - string = str->val; - end = str->len; + string = ZSTR_VAL(str); + end = ZSTR_LEN(str); charset = (char *) safe_emalloc((end + 1), 2, 0); text = &charset[end + 1]; diff --git a/ext/interbase/ibase_events.c b/ext/interbase/ibase_events.c index a454b2d011..6918886060 100644 --- a/ext/interbase/ibase_events.c +++ b/ext/interbase/ibase_events.c @@ -318,7 +318,7 @@ PHP_FUNCTION(ibase_set_event_handler) /* get the callback */ if (!zend_is_callable(cb_arg, 0, &cb_name)) { - _php_ibase_module_error("Callback argument %s is not a callable function", cb_name->val); + _php_ibase_module_error("Callback argument %s is not a callable function", ZSTR_VAL(cb_name)); zend_string_release(cb_name); RETURN_FALSE; } diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c index 401842e431..a4fb0678fb 100644 --- a/ext/ldap/ldap.c +++ b/ext/ldap/ldap.c @@ -1412,7 +1412,7 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper) ldap_mods[i]->mod_type = NULL; if (zend_hash_get_current_key(Z_ARRVAL_P(entry), &attribute, &index) == HASH_KEY_IS_STRING) { - ldap_mods[i]->mod_type = estrndup(attribute->val, attribute->len); + ldap_mods[i]->mod_type = estrndup(ZSTR_VAL(attribute), ZSTR_LEN(attribute)); } else { php_error_docref(NULL, E_WARNING, "Unknown attribute in the data"); /* Free allocated memory */ @@ -1696,9 +1696,9 @@ PHP_FUNCTION(ldap_modify_batch) /* is this a valid entry? */ if ( - !_ldap_str_equal_to_const(modkey->val, modkey->len, LDAP_MODIFY_BATCH_ATTRIB) && - !_ldap_str_equal_to_const(modkey->val, modkey->len, LDAP_MODIFY_BATCH_MODTYPE) && - !_ldap_str_equal_to_const(modkey->val, modkey->len, LDAP_MODIFY_BATCH_VALUES) + !_ldap_str_equal_to_const(ZSTR_VAL(modkey), ZSTR_LEN(modkey), LDAP_MODIFY_BATCH_ATTRIB) && + !_ldap_str_equal_to_const(ZSTR_VAL(modkey), ZSTR_LEN(modkey), LDAP_MODIFY_BATCH_MODTYPE) && + !_ldap_str_equal_to_const(ZSTR_VAL(modkey), ZSTR_LEN(modkey), LDAP_MODIFY_BATCH_VALUES) ) { php_error_docref(NULL, E_WARNING, "The only allowed keys in entries of the modifications array are '" LDAP_MODIFY_BATCH_ATTRIB "', '" LDAP_MODIFY_BATCH_MODTYPE "' and '" LDAP_MODIFY_BATCH_VALUES "'"); RETURN_FALSE; @@ -1708,7 +1708,7 @@ PHP_FUNCTION(ldap_modify_batch) modinfo = fetched; /* does the value type match the key? */ - if (_ldap_str_equal_to_const(modkey->val, modkey->len, LDAP_MODIFY_BATCH_ATTRIB)) { + if (_ldap_str_equal_to_const(ZSTR_VAL(modkey), ZSTR_LEN(modkey), LDAP_MODIFY_BATCH_ATTRIB)) { if (Z_TYPE_P(modinfo) != IS_STRING) { php_error_docref(NULL, E_WARNING, "A '" LDAP_MODIFY_BATCH_ATTRIB "' value must be a string"); RETURN_FALSE; @@ -1719,7 +1719,7 @@ PHP_FUNCTION(ldap_modify_batch) RETURN_FALSE; } } - else if (_ldap_str_equal_to_const(modkey->val, modkey->len, LDAP_MODIFY_BATCH_MODTYPE)) { + else if (_ldap_str_equal_to_const(ZSTR_VAL(modkey), ZSTR_LEN(modkey), LDAP_MODIFY_BATCH_MODTYPE)) { if (Z_TYPE_P(modinfo) != IS_LONG) { php_error_docref(NULL, E_WARNING, "A '" LDAP_MODIFY_BATCH_MODTYPE "' value must be a long"); RETURN_FALSE; @@ -1751,7 +1751,7 @@ PHP_FUNCTION(ldap_modify_batch) } } } - else if (_ldap_str_equal_to_const(modkey->val, modkey->len, LDAP_MODIFY_BATCH_VALUES)) { + else if (_ldap_str_equal_to_const(ZSTR_VAL(modkey), ZSTR_LEN(modkey), LDAP_MODIFY_BATCH_VALUES)) { if (Z_TYPE_P(modinfo) != IS_ARRAY) { php_error_docref(NULL, E_WARNING, "A '" LDAP_MODIFY_BATCH_VALUES "' value must be an array"); RETURN_FALSE; @@ -2614,7 +2614,7 @@ PHP_FUNCTION(ldap_set_rebind_proc) /* callable? */ if (!zend_is_callable(callback, 0, &callback_name)) { - php_error_docref(NULL, E_WARNING, "Two arguments expected for '%s' to be a valid callback", callback_name->val); + php_error_docref(NULL, E_WARNING, "Two arguments expected for '%s' to be a valid callback", ZSTR_VAL(callback_name)); zend_string_release(callback_name); RETURN_FALSE; } diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c index 365e37cc20..95bcd9978c 100644 --- a/ext/mysqli/mysqli_api.c +++ b/ext/mysqli/mysqli_api.c @@ -41,24 +41,24 @@ static void mysqli_tx_cor_options_to_string(const MYSQL * const conn, smart_str * str, const uint32_t mode) { if (mode & TRANS_COR_AND_CHAIN && !(mode & TRANS_COR_AND_NO_CHAIN)) { - if (str->s && str->s->len) { + if (str->s && ZSTR_LEN(str->s)) { smart_str_appendl(str, " ", sizeof(" ") - 1); } smart_str_appendl(str, "AND CHAIN", sizeof("AND CHAIN") - 1); } else if (mode & TRANS_COR_AND_NO_CHAIN && !(mode & TRANS_COR_AND_CHAIN)) { - if (str->s && str->s->len) { + if (str->s && ZSTR_LEN(str->s)) { smart_str_appendl(str, " ", sizeof(" ") - 1); } smart_str_appendl(str, "AND NO CHAIN", sizeof("AND NO CHAIN") - 1); } if (mode & TRANS_COR_RELEASE && !(mode & TRANS_COR_NO_RELEASE)) { - if (str->s && str->s->len) { + if (str->s && ZSTR_LEN(str->s)) { smart_str_appendl(str, " ", sizeof(" ") - 1); } smart_str_appendl(str, "RELEASE", sizeof("RELEASE") - 1); } else if (mode & TRANS_COR_NO_RELEASE && !(mode & TRANS_COR_RELEASE)) { - if (str->s && str->s->len) { + if (str->s && ZSTR_LEN(str->s)) { smart_str_appendl(str, " ", sizeof(" ") - 1); } smart_str_appendl(str, "NO RELEASE", sizeof("NO RELEASE") - 1); @@ -122,7 +122,7 @@ static int mysqli_commit_or_rollback_libmysql(MYSQL * conn, zend_bool commit, co size_t query_len; query_len = spprintf(&query, 0, - (commit? "COMMIT%s %s":"ROLLBACK%s %s"), name_esc? name_esc:"", tmp_str.s? tmp_str.s->val:""); + (commit? "COMMIT%s %s":"ROLLBACK%s %s"), name_esc? name_esc:"", tmp_str.s? ZSTR_VAL(tmp_str.s):""); smart_str_free(&tmp_str); if (name_esc) { efree(name_esc); diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c index eac443660a..49432b67cd 100644 --- a/ext/odbc/php_odbc.c +++ b/ext/odbc/php_odbc.c @@ -526,9 +526,9 @@ static PHP_INI_DISP(display_link_nums) char *value; if (type == PHP_INI_DISPLAY_ORIG && ini_entry->modified) { - value = ini_entry->orig_value->val; + value = ZSTR_VAL(ini_entry->orig_value); } else if (ini_entry->value) { - value = ini_entry->value->val; + value = ZSTR_VAL(ini_entry->value); } else { value = NULL; } @@ -550,9 +550,9 @@ static PHP_INI_DISP(display_defPW) char *value; if (type == PHP_INI_DISPLAY_ORIG && ini_entry->modified) { - value = ini_entry->orig_value->val; + value = ZSTR_VAL(ini_entry->orig_value); } else if (ini_entry->value) { - value = ini_entry->value->val; + value = ZSTR_VAL(ini_entry->value); } else { value = NULL; } @@ -580,9 +580,9 @@ static PHP_INI_DISP(display_binmode) char *value; if (type == PHP_INI_DISPLAY_ORIG && ini_entry->modified) { - value = ini_entry->orig_value->val; + value = ZSTR_VAL(ini_entry->orig_value); } else if (ini_entry->value) { - value = ini_entry->value->val; + value = ZSTR_VAL(ini_entry->value); } else { value = NULL; } @@ -610,9 +610,9 @@ static PHP_INI_DISP(display_lrl) char *value; if (type == PHP_INI_DISPLAY_ORIG && ini_entry->modified) { - value = ini_entry->orig_value->val; + value = ZSTR_VAL(ini_entry->orig_value); } else if (ini_entry->value) { - value = ini_entry->value->val; + value = ZSTR_VAL(ini_entry->value); } else { value = NULL; } @@ -635,9 +635,9 @@ static PHP_INI_DISP(display_cursortype) char *value; if (type == PHP_INI_DISPLAY_ORIG && ini_entry->modified) { - value = ini_entry->orig_value->val; + value = ZSTR_VAL(ini_entry->orig_value); } else if (ini_entry->value) { - value = ini_entry->value->val; + value = ZSTR_VAL(ini_entry->value); } else { value = NULL; } @@ -3046,16 +3046,16 @@ static void php_odbc_lasterror(INTERNAL_FUNCTION_PARAMETERS, int mode) } ptr = zend_string_alloc(len + 1, 0); if (mode == 0) { - strlcpy(ptr->val, conn->laststate, len+1); + strlcpy(ZSTR_VAL(ptr), conn->laststate, len+1); } else { - strlcpy(ptr->val, conn->lasterrormsg, len+1); + strlcpy(ZSTR_VAL(ptr), conn->lasterrormsg, len+1); } } else { ptr = zend_string_alloc(len, 0); if (mode == 0) { - strlcpy(ptr->val, ODBCG(laststate), len+1); + strlcpy(ZSTR_VAL(ptr), ODBCG(laststate), len+1); } else { - strlcpy(ptr->val, ODBCG(lasterrormsg), len+1); + strlcpy(ZSTR_VAL(ptr), ODBCG(lasterrormsg), len+1); } } RETVAL_STR(ptr); diff --git a/ext/pdo_firebird/firebird_statement.c b/ext/pdo_firebird/firebird_statement.c index 337ce3fb66..1e0151dc9d 100644 --- a/ext/pdo_firebird/firebird_statement.c +++ b/ext/pdo_firebird/firebird_statement.c @@ -198,7 +198,7 @@ static int firebird_stmt_describe(pdo_stmt_t *stmt, int colno) /* {{{ */ col->precision = -var->sqlscale; col->maxlen = var->sqllen; col->name = zend_string_alloc(colname_len, 0); - cp = col->name->val; + cp = ZSTR_VAL(col->name); if (colname_len > var->aliasname_length) { memmove(cp, var->relname, var->relname_length); cp += var->relname_length; @@ -475,10 +475,10 @@ static int firebird_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_dat for (i = 0; i < sqlda->sqld; ++i) { XSQLVAR *var = &sqlda->sqlvar[i]; - if ((var->aliasname_length && !strncasecmp(param->name->val, var->aliasname, - min(param->name->len, var->aliasname_length))) - || (var->sqlname_length && !strncasecmp(param->name->val, var->sqlname, - min(param->name->len, var->sqlname_length)))) { + if ((var->aliasname_length && !strncasecmp(ZSTR_VAL(param->name), var->aliasname, + min(ZSTR_LEN(param->name), var->aliasname_length))) + || (var->sqlname_length && !strncasecmp(ZSTR_VAL(param->name), var->sqlname, + min(ZSTR_LEN(param->name), var->sqlname_length)))) { param->paramno = i; break; } @@ -631,7 +631,7 @@ static int firebird_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_dat } case PDO_PARAM_EVT_NORMALIZE: if (!param->is_param) { - char *s = param->name->val; + char *s = ZSTR_VAL(param->name); while (*s != '\0') { *s = toupper(*s); s++; diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c index a4c6e4a6db..09a07f4f6f 100644 --- a/main/fopen_wrappers.c +++ b/main/fopen_wrappers.c @@ -90,24 +90,24 @@ PHPAPI ZEND_INI_MH(OnUpdateBaseDir) if (stage == PHP_INI_STAGE_STARTUP || stage == PHP_INI_STAGE_SHUTDOWN || stage == PHP_INI_STAGE_ACTIVATE || stage == PHP_INI_STAGE_DEACTIVATE) { /* We're in a PHP_INI_SYSTEM context, no restrictions */ - *p = new_value ? new_value->val : NULL; + *p = new_value ? ZSTR_VAL(new_value) : NULL; return SUCCESS; } /* Otherwise we're in runtime */ if (!*p || !**p) { /* open_basedir not set yet, go ahead and give it a value */ - *p = new_value->val; + *p = ZSTR_VAL(new_value); return SUCCESS; } /* Shortcut: When we have a open_basedir and someone tries to unset, we know it'll fail */ - if (!new_value || !*new_value->val) { + if (!new_value || !*ZSTR_VAL(new_value)) { return FAILURE; } /* Is the proposed open_basedir at least as restrictive as the current setting? */ - ptr = pathbuf = estrdup(new_value->val); + ptr = pathbuf = estrdup(ZSTR_VAL(new_value)); while (ptr && *ptr) { end = strchr(ptr, DEFAULT_DIR_SEPARATOR); if (end != NULL) { @@ -124,7 +124,7 @@ PHPAPI ZEND_INI_MH(OnUpdateBaseDir) efree(pathbuf); /* Everything checks out, set it */ - *p = new_value->val; + *p = ZSTR_VAL(new_value); return SUCCESS; } @@ -573,8 +573,8 @@ PHPAPI zend_string *php_resolve_path(const char *filename, int filename_length, */ if (zend_is_executing() && (exec_filename = zend_get_executed_filename_ex()) != NULL) { - const char *exec_fname = exec_filename->val; - size_t exec_fname_length = exec_filename->len; + const char *exec_fname = ZSTR_VAL(exec_filename); + size_t exec_fname_length = ZSTR_LEN(exec_filename); while ((--exec_fname_length < SIZE_MAX) && !IS_SLASH(exec_fname[exec_fname_length])); if (exec_fname_length > 0 && @@ -651,8 +651,8 @@ PHPAPI FILE *php_fopen_with_path(const char *filename, const char *mode, const c */ if (zend_is_executing() && (exec_filename = zend_get_executed_filename_ex()) != NULL) { - const char *exec_fname = exec_filename->val; - size_t exec_fname_length = exec_filename->len; + const char *exec_fname = ZSTR_VAL(exec_filename); + size_t exec_fname_length = ZSTR_LEN(exec_filename); while ((--exec_fname_length < SIZE_MAX) && !IS_SLASH(exec_fname[exec_fname_length])); if ((exec_fname && exec_fname[0] == '[') || exec_fname_length <= 0) { diff --git a/main/main.c b/main/main.c index 2d58b9c99c..26b2531724 100644 --- a/main/main.c +++ b/main/main.c @@ -130,7 +130,7 @@ static PHP_INI_MH(OnSetPrecision) { zend_long i; - ZEND_ATOL(i, new_value->val); + ZEND_ATOL(i, ZSTR_VAL(new_value)); if (i >= 0) { EG(precision) = i; return SUCCESS; @@ -145,7 +145,7 @@ static PHP_INI_MH(OnSetPrecision) static PHP_INI_MH(OnChangeMemoryLimit) { if (new_value) { - PG(memory_limit) = zend_atol(new_value->val, (int)new_value->len); + PG(memory_limit) = zend_atol(ZSTR_VAL(new_value), (int)ZSTR_LEN(new_value)); } else { PG(memory_limit) = 1<<30; /* effectively, no limit */ } @@ -286,11 +286,11 @@ static PHP_INI_MH(OnUpdateTimeout) { if (stage==PHP_INI_STAGE_STARTUP) { /* Don't set a timeout on startup, only per-request */ - ZEND_ATOL(EG(timeout_seconds), new_value->val); + ZEND_ATOL(EG(timeout_seconds), ZSTR_VAL(new_value)); return SUCCESS; } zend_unset_timeout(); - ZEND_ATOL(EG(timeout_seconds), new_value->val); + ZEND_ATOL(EG(timeout_seconds), ZSTR_VAL(new_value)); zend_set_timeout(EG(timeout_seconds), 0); return SUCCESS; } @@ -331,7 +331,7 @@ static int php_get_display_errors_mode(char *value, int value_length) */ static PHP_INI_MH(OnUpdateDisplayErrors) { - PG(display_errors) = (zend_bool) php_get_display_errors_mode(new_value->val, (int)new_value->len); + PG(display_errors) = (zend_bool) php_get_display_errors_mode(ZSTR_VAL(new_value), (int)ZSTR_LEN(new_value)); return SUCCESS; } @@ -345,11 +345,11 @@ static PHP_INI_DISP(display_errors_mode) char *tmp_value; if (type == ZEND_INI_DISPLAY_ORIG && ini_entry->modified) { - tmp_value = (ini_entry->orig_value ? ini_entry->orig_value->val : NULL ); - tmp_value_length = (int)(ini_entry->orig_value? ini_entry->orig_value->len : 0); + tmp_value = (ini_entry->orig_value ? ZSTR_VAL(ini_entry->orig_value) : NULL ); + tmp_value_length = (int)(ini_entry->orig_value? ZSTR_LEN(ini_entry->orig_value) : 0); } else if (ini_entry->value) { - tmp_value = ini_entry->value->val; - tmp_value_length = (int)ini_entry->value->len; + tmp_value = ZSTR_VAL(ini_entry->value); + tmp_value_length = (int)ZSTR_LEN(ini_entry->value); } else { tmp_value = NULL; tmp_value_length = 0; @@ -422,8 +422,8 @@ static PHP_INI_MH(OnUpdateOutputEncoding) static PHP_INI_MH(OnUpdateErrorLog) { /* Only do the safemode/open_basedir check at runtime */ - if ((stage == PHP_INI_STAGE_RUNTIME || stage == PHP_INI_STAGE_HTACCESS) && new_value && strcmp(new_value->val, "syslog")) { - if (PG(open_basedir) && php_check_open_basedir(new_value->val)) { + if ((stage == PHP_INI_STAGE_RUNTIME || stage == PHP_INI_STAGE_HTACCESS) && new_value && strcmp(ZSTR_VAL(new_value), "syslog")) { + if (PG(open_basedir) && php_check_open_basedir(ZSTR_VAL(new_value))) { return FAILURE; } } @@ -438,7 +438,7 @@ static PHP_INI_MH(OnUpdateMailLog) { /* Only do the safemode/open_basedir check at runtime */ if ((stage == PHP_INI_STAGE_RUNTIME || stage == PHP_INI_STAGE_HTACCESS) && new_value) { - if (PG(open_basedir) && php_check_open_basedir(new_value->val)) { + if (PG(open_basedir) && php_check_open_basedir(ZSTR_VAL(new_value))) { return FAILURE; } } @@ -645,7 +645,7 @@ PHPAPI void php_log_err(char *log_message) #else error_time_str = php_format_date("d-M-Y H:i:s e", 13, error_time, 1); #endif - len = spprintf(&tmp, 0, "[%s] %s%s", error_time_str->val, log_message, PHP_EOL); + len = spprintf(&tmp, 0, "[%s] %s%s", ZSTR_VAL(error_time_str), log_message, PHP_EOL); #ifdef PHP_WIN32 php_flock(fd, 2); /* XXX should eventually write in a loop if len > UINT_MAX */ @@ -724,8 +724,8 @@ PHPAPI void php_verror(const char *docref, const char *params, int type, const c if (PG(html_errors)) { replace_buffer = php_escape_html_entities((unsigned char*)buffer, buffer_len, 0, ENT_COMPAT, NULL); efree(buffer); - buffer = replace_buffer->val; - buffer_len = (int)replace_buffer->len; + buffer = ZSTR_VAL(replace_buffer); + buffer_len = (int)ZSTR_LEN(replace_buffer); } /* which function caused the problem if any at all */ @@ -783,7 +783,7 @@ PHPAPI void php_verror(const char *docref, const char *params, int type, const c if (PG(html_errors)) { replace_origin = php_escape_html_entities((unsigned char*)origin, origin_len, 0, ENT_COMPAT, NULL); efree(origin); - origin = replace_origin->val; + origin = ZSTR_VAL(replace_origin); } /* origin and buffer available, so lets come up with the error message */ @@ -1098,7 +1098,7 @@ static void php_error_cb(int type, const char *error_filename, const uint error_ if (PG(html_errors)) { if (type == E_ERROR || type == E_PARSE) { zend_string *buf = php_escape_html_entities((unsigned char*)buffer, buffer_len, 0, ENT_COMPAT, NULL); - php_printf("%s<br />\n<b>%s</b>: %s in <b>%s</b> on line <b>%d</b><br />\n%s", STR_PRINT(prepend_string), error_type_str, buf->val, error_filename, error_lineno, STR_PRINT(append_string)); + php_printf("%s<br />\n<b>%s</b>: %s in <b>%s</b> on line <b>%d</b><br />\n%s", STR_PRINT(prepend_string), error_type_str, ZSTR_VAL(buf), error_filename, error_lineno, STR_PRINT(append_string)); zend_string_free(buf); } else { php_printf("%s<br />\n<b>%s</b>: %s in <b>%s</b> on line <b>%d</b><br />\n%s", STR_PRINT(prepend_string), error_type_str, buffer, error_filename, error_lineno, STR_PRINT(append_string)); @@ -2560,10 +2560,10 @@ PHPAPI int php_handle_auth_data(const char *auth) user = php_base64_decode((const unsigned char*)auth + 6, strlen(auth) - 6); if (user) { - pass = strchr(user->val, ':'); + pass = strchr(ZSTR_VAL(user), ':'); if (pass) { *pass++ = '\0'; - SG(request_info).auth_user = estrndup(user->val, user->len); + SG(request_info).auth_user = estrndup(ZSTR_VAL(user), ZSTR_LEN(user)); SG(request_info).auth_password = estrdup(pass); ret = 0; } diff --git a/main/network.c b/main/network.c index e4c99ec064..c08194bcd6 100644 --- a/main/network.c +++ b/main/network.c @@ -213,7 +213,7 @@ PHPAPI int php_network_getaddresses(const char *host, int socktype, struct socka if ((n = getaddrinfo(host, NULL, &hints, &res))) { if (error_string) { *error_string = strpprintf(0, "php_network_getaddresses: getaddrinfo failed: %s", PHP_GAI_STRERROR(n)); - php_error_docref(NULL, E_WARNING, "%s", (*error_string)->val); + php_error_docref(NULL, E_WARNING, "%s", ZSTR_VAL(*error_string)); } else { php_error_docref(NULL, E_WARNING, "php_network_getaddresses: getaddrinfo failed: %s", PHP_GAI_STRERROR(n)); } @@ -221,7 +221,7 @@ PHPAPI int php_network_getaddresses(const char *host, int socktype, struct socka } else if (res == NULL) { if (error_string) { *error_string = strpprintf(0, "php_network_getaddresses: getaddrinfo failed (null result pointer) errno=%d", errno); - php_error_docref(NULL, E_WARNING, "%s", (*error_string)->val); + php_error_docref(NULL, E_WARNING, "%s", ZSTR_VAL(*error_string)); } else { php_error_docref(NULL, E_WARNING, "php_network_getaddresses: getaddrinfo failed (null result pointer)"); } @@ -255,7 +255,7 @@ PHPAPI int php_network_getaddresses(const char *host, int socktype, struct socka if (host_info == NULL) { if (error_string) { error_string = strpprintf(0, "php_network_getaddresses: gethostbyname failed. errno=%d", errno); - php_error_docref(NULL, E_WARNING, "%s", (*error_string)->val); + php_error_docref(NULL, E_WARNING, "%s", ZSTR_VAL(*error_string)); } else { php_error_docref(NULL, E_WARNING, "php_network_getaddresses: gethostbyname failed"); } @@ -567,7 +567,7 @@ PHPAPI int php_network_parse_network_address_with_port(const char *addr, zend_lo if (n == 0) { if (errstr) { - php_error_docref(NULL, E_WARNING, "Failed to resolve `%s': %s", tmp, errstr->val); + php_error_docref(NULL, E_WARNING, "Failed to resolve `%s': %s", tmp, ZSTR_VAL(errstr)); zend_string_release(errstr); } goto out; diff --git a/main/output.c b/main/output.c index a0a300b376..5c56fe98cd 100644 --- a/main/output.c +++ b/main/output.c @@ -110,7 +110,7 @@ static void php_output_header(void) if (!SG(headers_sent)) { if (!OG(output_start_filename)) { if (zend_is_compiling()) { - OG(output_start_filename) = zend_get_compiled_filename()->val; + OG(output_start_filename) = ZSTR_VAL(zend_get_compiled_filename()); OG(output_start_lineno) = zend_get_compiled_lineno(); } else if (zend_is_executing()) { OG(output_start_filename) = zend_get_executed_filename(); @@ -550,13 +550,13 @@ PHPAPI int php_output_handler_start(php_output_handler *handler) return FAILURE; } if (NULL != (conflict = zend_hash_find_ptr(&php_output_handler_conflicts, handler->name))) { - if (SUCCESS != conflict(handler->name->val, handler->name->len)) { + if (SUCCESS != conflict(ZSTR_VAL(handler->name), ZSTR_LEN(handler->name))) { return FAILURE; } } if (NULL != (rconflicts = zend_hash_find_ptr(&php_output_handler_reverse_conflicts, handler->name))) { ZEND_HASH_FOREACH_PTR(rconflicts, conflict) { - if (SUCCESS != conflict(handler->name->val, handler->name->len)) { + if (SUCCESS != conflict(ZSTR_VAL(handler->name), ZSTR_LEN(handler->name))) { return FAILURE; } } ZEND_HASH_FOREACH_END(); @@ -579,7 +579,7 @@ PHPAPI int php_output_handler_started(const char *name, size_t name_len) handlers = (php_output_handler **) zend_stack_base(&OG(handlers)); for (i = 0; i < count; ++i) { - if (name_len == handlers[i]->name->len && !memcmp(handlers[i]->name->val, name, name_len)) { + if (name_len == ZSTR_LEN(handlers[i]->name) && !memcmp(ZSTR_VAL(handlers[i]->name), name, name_len)) { return 1; } } @@ -1203,7 +1203,7 @@ static inline int php_output_stack_pop(int flags) return 0; } else if (!(flags & PHP_OUTPUT_POP_FORCE) && !(orphan->flags & PHP_OUTPUT_HANDLER_REMOVABLE)) { if (!(flags & PHP_OUTPUT_POP_SILENT)) { - php_error_docref("ref.outcontrol", E_NOTICE, "failed to %s buffer of %s (%d)", (flags&PHP_OUTPUT_POP_DISCARD)?"discard":"send", orphan->name->val, orphan->level); + php_error_docref("ref.outcontrol", E_NOTICE, "failed to %s buffer of %s (%d)", (flags&PHP_OUTPUT_POP_DISCARD)?"discard":"send", ZSTR_VAL(orphan->name), orphan->level); } return 0; } else { @@ -1330,7 +1330,7 @@ PHP_FUNCTION(ob_flush) } if (SUCCESS != php_output_flush()) { - php_error_docref("ref.outcontrol", E_NOTICE, "failed to flush buffer of %s (%d)", OG(active)->name->val, OG(active)->level); + php_error_docref("ref.outcontrol", E_NOTICE, "failed to flush buffer of %s (%d)", ZSTR_VAL(OG(active)->name), OG(active)->level); RETURN_FALSE; } RETURN_TRUE; @@ -1351,7 +1351,7 @@ PHP_FUNCTION(ob_clean) } if (SUCCESS != php_output_clean()) { - php_error_docref("ref.outcontrol", E_NOTICE, "failed to delete buffer of %s (%d)", OG(active)->name->val, OG(active)->level); + php_error_docref("ref.outcontrol", E_NOTICE, "failed to delete buffer of %s (%d)", ZSTR_VAL(OG(active)->name), OG(active)->level); RETURN_FALSE; } RETURN_TRUE; @@ -1406,7 +1406,7 @@ PHP_FUNCTION(ob_get_flush) } if (SUCCESS != php_output_end()) { - php_error_docref("ref.outcontrol", E_NOTICE, "failed to delete buffer of %s (%d)", OG(active)->name->val, OG(active)->level); + php_error_docref("ref.outcontrol", E_NOTICE, "failed to delete buffer of %s (%d)", ZSTR_VAL(OG(active)->name), OG(active)->level); } } /* }}} */ @@ -1429,7 +1429,7 @@ PHP_FUNCTION(ob_get_clean) } if (SUCCESS != php_output_discard()) { - php_error_docref("ref.outcontrol", E_NOTICE, "failed to delete buffer of %s (%d)", OG(active)->name->val, OG(active)->level); + php_error_docref("ref.outcontrol", E_NOTICE, "failed to delete buffer of %s (%d)", ZSTR_VAL(OG(active)->name), OG(active)->level); } } /* }}} */ diff --git a/main/php_ini.c b/main/php_ini.c index 99919ca56e..ac79e60879 100644 --- a/main/php_ini.c +++ b/main/php_ini.c @@ -80,9 +80,9 @@ static void php_ini_displayer_cb(zend_ini_entry *ini_entry, int type) int esc_html=0; if (type == ZEND_INI_DISPLAY_ORIG && ini_entry->modified) { - if (ini_entry->orig_value && ini_entry->orig_value->val[0]) { - display_string = ini_entry->orig_value->val; - display_string_length = ini_entry->orig_value->len; + if (ini_entry->orig_value && ZSTR_VAL(ini_entry->orig_value)[0]) { + display_string = ZSTR_VAL(ini_entry->orig_value); + display_string_length = ZSTR_LEN(ini_entry->orig_value); esc_html = !sapi_module.phpinfo_as_text; } else { if (!sapi_module.phpinfo_as_text) { @@ -93,9 +93,9 @@ static void php_ini_displayer_cb(zend_ini_entry *ini_entry, int type) display_string_length = sizeof("no value") - 1; } } - } else if (ini_entry->value && ini_entry->value->val[0]) { - display_string = ini_entry->value->val; - display_string_length = ini_entry->value->len; + } else if (ini_entry->value && ZSTR_VAL(ini_entry->value)[0]) { + display_string = ZSTR_VAL(ini_entry->value); + display_string_length = ZSTR_LEN(ini_entry->value); esc_html = !sapi_module.phpinfo_as_text; } else { if (!sapi_module.phpinfo_as_text) { @@ -129,14 +129,14 @@ static int php_ini_displayer(zval *el, void *arg) if (!sapi_module.phpinfo_as_text) { PUTS("<tr>"); PUTS("<td class=\"e\">"); - PHPWRITE(ini_entry->name->val, ini_entry->name->len); + PHPWRITE(ZSTR_VAL(ini_entry->name), ZSTR_LEN(ini_entry->name)); PUTS("</td><td class=\"v\">"); php_ini_displayer_cb(ini_entry, ZEND_INI_DISPLAY_ACTIVE); PUTS("</td><td class=\"v\">"); php_ini_displayer_cb(ini_entry, ZEND_INI_DISPLAY_ORIG); PUTS("</td></tr>\n"); } else { - PHPWRITE(ini_entry->name->val, ini_entry->name->len); + PHPWRITE(ZSTR_VAL(ini_entry->name), ZSTR_LEN(ini_entry->name)); PUTS(" => "); php_ini_displayer_cb(ini_entry, ZEND_INI_DISPLAY_ACTIVE); PUTS(" => "); @@ -567,7 +567,7 @@ int php_init_config(void) fh.handle.fp = php_fopen_with_path(ini_fname, "r", php_ini_search_path, &opened_path); efree(ini_fname); if (fh.handle.fp) { - fh.filename = opened_path->val; + fh.filename = ZSTR_VAL(opened_path); } } @@ -575,7 +575,7 @@ int php_init_config(void) if (!fh.handle.fp) { fh.handle.fp = php_fopen_with_path("php.ini", "r", php_ini_search_path, &opened_path); if (fh.handle.fp) { - fh.filename = opened_path->val; + fh.filename = ZSTR_VAL(opened_path); } } } diff --git a/main/php_variables.c b/main/php_variables.c index d800a2d3c4..43b00d9322 100644 --- a/main/php_variables.c +++ b/main/php_variables.c @@ -293,8 +293,8 @@ static inline int add_post_vars(zval *arr, post_var_data_t *vars, zend_bool eof) { uint64_t max_vars = PG(max_input_vars); - vars->ptr = vars->str.s->val; - vars->end = vars->str.s->val + vars->str.s->len; + vars->ptr = ZSTR_VAL(vars->str.s); + vars->end = ZSTR_VAL(vars->str.s) + ZSTR_LEN(vars->str.s); while (add_post_var(arr, vars, eof)) { if (++vars->cnt > max_vars) { php_error_docref(NULL, E_WARNING, @@ -306,7 +306,7 @@ static inline int add_post_vars(zval *arr, post_var_data_t *vars, zend_bool eof) } if (!eof) { - memmove(vars->str.s->val, vars->ptr, vars->str.s->len = vars->end - vars->ptr); + memmove(ZSTR_VAL(vars->str.s), vars->ptr, ZSTR_LEN(vars->str.s) = vars->end - vars->ptr); } return SUCCESS; } @@ -640,8 +640,8 @@ static void php_autoglobal_merge(HashTable *dest, HashTable *src) Z_ADDREF_P(src_entry); } if (string_key) { - if (!globals_check || string_key->len != sizeof("GLOBALS") - 1 - || memcmp(string_key->val, "GLOBALS", sizeof("GLOBALS") - 1)) { + if (!globals_check || ZSTR_LEN(string_key) != sizeof("GLOBALS") - 1 + || memcmp(ZSTR_VAL(string_key), "GLOBALS", sizeof("GLOBALS") - 1)) { zend_hash_update(dest, string_key, src_entry); } else if (Z_REFCOUNTED_P(src_entry)) { Z_DELREF_P(src_entry); diff --git a/main/rfc1867.c b/main/rfc1867.c index 30457f3bca..1db3cd303f 100644 --- a/main/rfc1867.c +++ b/main/rfc1867.c @@ -193,7 +193,7 @@ static void register_http_post_files_variable_ex(char *var, zval *val, zval *htt static int unlink_filename(zval *el) /* {{{ */ { zend_string *filename = Z_STR_P(el); - VCWD_UNLINK(filename->val); + VCWD_UNLINK(ZSTR_VAL(filename)); return 0; } /* }}} */ @@ -1099,7 +1099,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ multipart_event_file_end event_file_end; event_file_end.post_bytes_processed = SG(read_post_bytes); - event_file_end.temp_filename = temp_filename->val; + event_file_end.temp_filename = ZSTR_VAL(temp_filename); event_file_end.cancel_upload = cancel_upload; if (php_rfc1867_callback(MULTIPART_EVENT_FILE_END, &event_file_end, &event_extra_data) == FAILURE) { cancel_upload = UPLOAD_ERROR_X; @@ -1109,7 +1109,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */ if (cancel_upload) { if (temp_filename) { if (cancel_upload != UPLOAD_ERROR_E) { /* file creation failed */ - unlink(temp_filename->val); + unlink(ZSTR_VAL(temp_filename)); } zend_string_release(temp_filename); } diff --git a/main/spprintf.c b/main/spprintf.c index 322ea60adf..759372b370 100644 --- a/main/spprintf.c +++ b/main/spprintf.c @@ -145,8 +145,8 @@ ((smart_string *)(xbuf))->len += (count); \ } else { \ smart_str_alloc(((smart_str *)(xbuf)), (count), 0); \ - memset(((smart_str *)(xbuf))->s->val + ((smart_str *)(xbuf))->s->len, (ch), (count)); \ - ((smart_str *)(xbuf))->s->len += (count); \ + memset(ZSTR_VAL(((smart_str *)(xbuf))->s) + ZSTR_LEN(((smart_str *)(xbuf))->s), (ch), (count)); \ + ZSTR_LEN(((smart_str *)(xbuf))->s) += (count); \ } \ } while (0); @@ -741,7 +741,7 @@ static void xbuf_format_converter(void *xbuf, zend_bool is_char, const char *fmt case 'n': - *(va_arg(ap, int *)) = is_char? (int)((smart_string *)xbuf)->len : (int)((smart_str *)xbuf)->s->len; + *(va_arg(ap, int *)) = is_char? (int)((smart_string *)xbuf)->len : (int)ZSTR_LEN(((smart_str *)xbuf)->s); goto skip_output; /* @@ -883,8 +883,8 @@ PHPAPI zend_string *vstrpprintf(size_t max_len, const char *format, va_list ap) xbuf_format_converter(&buf, 0, format, ap); - if (max_len && buf.s && buf.s->len > max_len) { - buf.s->len = max_len; + if (max_len && buf.s && ZSTR_LEN(buf.s) > max_len) { + ZSTR_LEN(buf.s) = max_len; } smart_str_0(&buf); diff --git a/main/streams/memory.c b/main/streams/memory.c index 9efd1f10ac..5145776f7e 100644 --- a/main/streams/memory.c +++ b/main/streams/memory.c @@ -724,8 +724,8 @@ static php_stream * php_stream_url_wrap_rfc2397(php_stream_wrapper *wrapper, con php_stream_wrapper_log_error(wrapper, options, "rfc2397: unable to decode"); return NULL; } - comma = base64_comma->val; - ilen = (int)base64_comma->len; + comma = ZSTR_VAL(base64_comma); + ilen = (int)ZSTR_LEN(base64_comma); } else { comma = estrndup(comma, dlen); dlen = php_url_decode(comma, (int)dlen); diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c index bbd8cfbb51..e44e1ea348 100644 --- a/main/streams/plain_wrapper.c +++ b/main/streams/plain_wrapper.c @@ -207,7 +207,7 @@ PHPAPI php_stream *_php_stream_fopen_temporary_file(const char *dir, const char if (stream) { php_stdio_stream_data *self = (php_stdio_stream_data*)stream->abstract; stream->wrapper = &php_plain_files_wrapper; - stream->orig_path = estrndup(opened_path->val, opened_path->len); + stream->orig_path = estrndup(ZSTR_VAL(opened_path), ZSTR_LEN(opened_path)); self->temp_name = opened_path; self->lock_flag = LOCK_UN; @@ -451,7 +451,7 @@ static int php_stdiop_close(php_stream *stream, int close_handle) return 0; /* everything should be closed already -> success */ } if (data->temp_name) { - unlink(data->temp_name->val); + unlink(ZSTR_VAL(data->temp_name)); /* temporary streams are never persistent */ zend_string_release(data->temp_name); data->temp_name = NULL; @@ -1469,8 +1469,8 @@ not_relative_path: */ if (zend_is_executing() && (exec_filename = zend_get_executed_filename_ex()) != NULL) { - const char *exec_fname = exec_filename->val; - size_t exec_fname_length = exec_filename->len; + const char *exec_fname = ZSTR_VAL(exec_filename); + size_t exec_fname_length = ZSTR_LEN(exec_filename); while ((--exec_fname_length < SIZE_MAX) && !IS_SLASH(exec_fname[exec_fname_length])); if (exec_fname_length<=0) { diff --git a/main/streams/streams.c b/main/streams/streams.c index e8fa1e89b3..7f919ca834 100644 --- a/main/streams/streams.c +++ b/main/streams/streams.c @@ -831,8 +831,8 @@ PHPAPI const char *php_stream_locate_eol(php_stream *stream, zend_string *buf) readptr = (char*)stream->readbuf + stream->readpos; avail = stream->writepos - stream->readpos; } else { - readptr = buf->val; - avail = buf->len; + readptr = ZSTR_VAL(buf); + avail = ZSTR_LEN(buf); } /* Look for EOL */ @@ -1082,13 +1082,13 @@ PHPAPI zend_string *php_stream_get_record(php_stream *stream, size_t maxlen, con ret_buf = zend_string_alloc(tent_ret_len, 0); /* php_stream_read will not call ops->read here because the necessary * data is guaranteedly buffered */ - ret_buf->len = php_stream_read(stream, ret_buf->val, tent_ret_len); + ZSTR_LEN(ret_buf) = php_stream_read(stream, ZSTR_VAL(ret_buf), tent_ret_len); if (found_delim) { stream->readpos += delim_len; stream->position += delim_len; } - ret_buf->val[ret_buf->len] = '\0'; + ZSTR_VAL(ret_buf)[ZSTR_LEN(ret_buf)] = '\0'; return ret_buf; } @@ -1435,7 +1435,7 @@ PHPAPI zend_string *_php_stream_copy_to_mem(php_stream *src, size_t maxlen, int if (maxlen > 0) { result = zend_string_alloc(maxlen, persistent); - ptr = result->val; + ptr = ZSTR_VAL(result); while ((len < maxlen) && !php_stream_eof(src)) { ret = php_stream_read(src, ptr, maxlen - len); if (!ret) { @@ -1446,7 +1446,7 @@ PHPAPI zend_string *_php_stream_copy_to_mem(php_stream *src, size_t maxlen, int } if (len) { *ptr = '\0'; - result->len = len; + ZSTR_LEN(result) = len; } else { zend_string_free(result); result = NULL; @@ -1467,21 +1467,21 @@ PHPAPI zend_string *_php_stream_copy_to_mem(php_stream *src, size_t maxlen, int } result = zend_string_alloc(max_len, persistent); - ptr = result->val; + ptr = ZSTR_VAL(result); while ((ret = php_stream_read(src, ptr, max_len - len))) { len += ret; if (len + min_room >= max_len) { result = zend_string_extend(result, max_len + step, persistent); max_len += step; - ptr = result->val + len; + ptr = ZSTR_VAL(result) + len; } else { ptr += ret; } } if (len) { result = zend_string_truncate(result, len, persistent); - result->val[len] = '\0'; + ZSTR_VAL(result)[len] = '\0'; } else { zend_string_free(result); result = NULL; @@ -2033,7 +2033,7 @@ PHPAPI php_stream *_php_stream_open_wrapper_ex(const char *path, const char *mod if (options & USE_PATH) { resolved_path = zend_resolve_path(path, (int)strlen(path)); if (resolved_path) { - path = resolved_path->val; + path = ZSTR_VAL(resolved_path); /* we've found this file, don't re-check include_path or run realpath */ options |= STREAM_ASSUME_REALPATH; options &= ~USE_PATH; @@ -2253,7 +2253,7 @@ PHPAPI int php_stream_context_set_option(php_stream_context *context, */ PHPAPI int php_stream_dirent_alphasort(const zend_string **a, const zend_string **b) { - return strcoll((*a)->val, (*b)->val); + return strcoll(ZSTR_VAL(*a), ZSTR_VAL(*b)); } /* }}} */ @@ -2261,7 +2261,7 @@ PHPAPI int php_stream_dirent_alphasort(const zend_string **a, const zend_string */ PHPAPI int php_stream_dirent_alphasortr(const zend_string **a, const zend_string **b) { - return strcoll((*b)->val, (*a)->val); + return strcoll(ZSTR_VAL(*b), ZSTR_VAL(*a)); } /* }}} */ diff --git a/main/streams/transports.c b/main/streams/transports.c index b86019bf5d..eab6c42df7 100644 --- a/main/streams/transports.c +++ b/main/streams/transports.c @@ -45,7 +45,7 @@ PHPAPI int php_stream_xport_unregister(const char *protocol) #define ERR_RETURN(out_err, local_err, fmt) \ if (out_err) { *out_err = local_err; } \ - else { php_error_docref(NULL, E_WARNING, fmt, local_err ? local_err->val : "Unspecified error"); \ + else { php_error_docref(NULL, E_WARNING, fmt, local_err ? ZSTR_VAL(local_err) : "Unspecified error"); \ if (local_err) { zend_string_release(local_err); local_err = NULL; } \ } diff --git a/main/streams/userspace.c b/main/streams/userspace.c index 4d96bc6ebd..b73db20d40 100644 --- a/main/streams/userspace.c +++ b/main/streams/userspace.c @@ -315,7 +315,7 @@ static void user_stream_create_object(struct php_user_stream_wrapper *uwrap, php fcc.object = Z_OBJ_P(object); if (zend_call_function(&fci, &fcc) == FAILURE) { - php_error_docref(NULL, E_WARNING, "Could not execute %s::%s()", uwrap->ce->name->val, uwrap->ce->constructor->common.function_name->val); + php_error_docref(NULL, E_WARNING, "Could not execute %s::%s()", ZSTR_VAL(uwrap->ce->name), ZSTR_VAL(uwrap->ce->constructor->common.function_name)); zval_dtor(object); ZVAL_UNDEF(object); } else { @@ -497,8 +497,8 @@ PHP_FUNCTION(stream_wrapper_register) } uwrap = (struct php_user_stream_wrapper *)ecalloc(1, sizeof(*uwrap)); - uwrap->protoname = estrndup(protocol->val, protocol->len); - uwrap->classname = estrndup(classname->val, classname->len); + uwrap->protoname = estrndup(ZSTR_VAL(protocol), ZSTR_LEN(protocol)); + uwrap->classname = estrndup(ZSTR_VAL(classname), ZSTR_LEN(classname)); uwrap->wrapper.wops = &user_stream_wops; uwrap->wrapper.abstract = uwrap; uwrap->wrapper.is_url = ((flags & PHP_STREAM_IS_URL) != 0); @@ -506,19 +506,19 @@ PHP_FUNCTION(stream_wrapper_register) rsrc = zend_register_resource(uwrap, le_protocols); if ((uwrap->ce = zend_lookup_class(classname)) != NULL) { - if (php_register_url_stream_wrapper_volatile(protocol->val, &uwrap->wrapper) == SUCCESS) { + if (php_register_url_stream_wrapper_volatile(ZSTR_VAL(protocol), &uwrap->wrapper) == SUCCESS) { RETURN_TRUE; } else { /* We failed. But why? */ if (zend_hash_exists(php_stream_get_url_stream_wrappers_hash(), protocol)) { - php_error_docref(NULL, E_WARNING, "Protocol %s:// is already defined.", protocol->val); + php_error_docref(NULL, E_WARNING, "Protocol %s:// is already defined.", ZSTR_VAL(protocol)); } else { /* Hash doesn't exist so it must have been an invalid protocol scheme */ - php_error_docref(NULL, E_WARNING, "Invalid protocol scheme specified. Unable to register wrapper class %s to %s://", classname->val, protocol->val); + php_error_docref(NULL, E_WARNING, "Invalid protocol scheme specified. Unable to register wrapper class %s to %s://", ZSTR_VAL(classname), ZSTR_VAL(protocol)); } } } else { - php_error_docref(NULL, E_WARNING, "class '%s' is undefined", classname->val); + php_error_docref(NULL, E_WARNING, "class '%s' is undefined", ZSTR_VAL(classname)); } zend_list_delete(rsrc); @@ -561,20 +561,20 @@ PHP_FUNCTION(stream_wrapper_restore) global_wrapper_hash = php_stream_get_url_stream_wrappers_hash_global(); if (php_stream_get_url_stream_wrappers_hash() == global_wrapper_hash) { - php_error_docref(NULL, E_NOTICE, "%s:// was never changed, nothing to restore", protocol->val); + php_error_docref(NULL, E_NOTICE, "%s:// was never changed, nothing to restore", ZSTR_VAL(protocol)); RETURN_TRUE; } if ((wrapper = zend_hash_find_ptr(global_wrapper_hash, protocol)) == NULL) { - php_error_docref(NULL, E_WARNING, "%s:// never existed, nothing to restore", protocol->val); + php_error_docref(NULL, E_WARNING, "%s:// never existed, nothing to restore", ZSTR_VAL(protocol)); RETURN_FALSE; } /* A failure here could be okay given that the protocol might have been merely unregistered */ - php_unregister_url_stream_wrapper_volatile(protocol->val); + php_unregister_url_stream_wrapper_volatile(ZSTR_VAL(protocol)); - if (php_register_url_stream_wrapper_volatile(protocol->val, wrapper) == FAILURE) { - php_error_docref(NULL, E_WARNING, "Unable to restore original %s:// wrapper", protocol->val); + if (php_register_url_stream_wrapper_volatile(ZSTR_VAL(protocol), wrapper) == FAILURE) { + php_error_docref(NULL, E_WARNING, "Unable to restore original %s:// wrapper", ZSTR_VAL(protocol)); RETURN_FALSE; } diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c index d622b099de..f76199af9a 100644 --- a/sapi/cli/php_cli_server.c +++ b/sapi/cli/php_cli_server.c @@ -546,7 +546,7 @@ static int sapi_cli_server_send_headers(sapi_headers_struct *sapi_headers) /* {{ } smart_str_appendl(&buffer, "\r\n", 2); - php_cli_server_client_send_through(client, buffer.s->val, buffer.s->len); + php_cli_server_client_send_through(client, ZSTR_VAL(buffer.s), ZSTR_LEN(buffer.s)); smart_str_free(&buffer); return SAPI_HEADER_SENT_SUCCESSFULLY; @@ -595,8 +595,8 @@ static int sapi_cli_server_register_entry_cb(char **entry, int num_args, va_list if (hash_key->key) { char *real_key, *key; uint i; - key = estrndup(hash_key->key->val, hash_key->key->len); - for(i=0; i<hash_key->key->len; i++) { + key = estrndup(ZSTR_VAL(hash_key->key), ZSTR_LEN(hash_key->key)); + for(i=0; i<ZSTR_LEN(hash_key->key); i++) { if (key[i] == '-') { key[i] = '_'; } else { @@ -1773,8 +1773,8 @@ static int php_cli_server_client_ctor(php_cli_server_client *client, php_cli_ser zend_string *addr_str = 0; php_network_populate_name_from_sockaddr(addr, addr_len, &addr_str, NULL, 0); - client->addr_str = pestrndup(addr_str->val, addr_str->len, 1); - client->addr_str_len = addr_str->len; + client->addr_str = pestrndup(ZSTR_VAL(addr_str), ZSTR_LEN(addr_str), 1); + client->addr_str_len = ZSTR_LEN(addr_str); zend_string_release(addr_str); } php_http_parser_init(&client->parser, PHP_HTTP_REQUEST); @@ -1832,7 +1832,7 @@ static int php_cli_server_send_error_page(php_cli_server *server, php_cli_server if (!chunk) { goto fail; } - snprintf(chunk->data.heap.p, chunk->data.heap.len, prologue_template, status, status_string, escaped_request_uri->val); + snprintf(chunk->data.heap.p, chunk->data.heap.len, prologue_template, status, status_string, ZSTR_VAL(escaped_request_uri)); chunk->data.heap.len = strlen(chunk->data.heap.p); php_cli_server_buffer_append(&client->content_sender.buffer, chunk); } @@ -1852,11 +1852,11 @@ static int php_cli_server_send_error_page(php_cli_server *server, php_cli_server php_cli_server_buffer_append(&client->content_sender.buffer, chunk); } { - php_cli_server_chunk *chunk = php_cli_server_chunk_heap_new_self_contained(strlen(content_template) + escaped_request_uri->len + 3 + strlen(status_string) + 1); + php_cli_server_chunk *chunk = php_cli_server_chunk_heap_new_self_contained(strlen(content_template) + ZSTR_LEN(escaped_request_uri) + 3 + strlen(status_string) + 1); if (!chunk) { goto fail; } - snprintf(chunk->data.heap.p, chunk->data.heap.len, content_template, status_string, escaped_request_uri->val); + snprintf(chunk->data.heap.p, chunk->data.heap.len, content_template, status_string, ZSTR_VAL(escaped_request_uri)); chunk->data.heap.len = strlen(chunk->data.heap.p); php_cli_server_buffer_append(&client->content_sender.buffer, chunk); } @@ -1884,7 +1884,7 @@ static int php_cli_server_send_error_page(php_cli_server *server, php_cli_server smart_str_appendl_ex(&buffer, "\r\n", 2, 1); smart_str_appendl_ex(&buffer, "\r\n", 2, 1); - chunk = php_cli_server_chunk_heap_new(buffer.s, buffer.s->val, buffer.s->len); + chunk = php_cli_server_chunk_heap_new(buffer.s, ZSTR_VAL(buffer.s), ZSTR_LEN(buffer.s)); if (!chunk) { smart_str_free(&buffer); goto fail; @@ -1974,7 +1974,7 @@ static int php_cli_server_begin_send_static(php_cli_server *server, php_cli_serv smart_str_append_unsigned_ex(&buffer, client->request.sb.st_size, 1); smart_str_appendl_ex(&buffer, "\r\n", 2, 1); smart_str_appendl_ex(&buffer, "\r\n", 2, 1); - chunk = php_cli_server_chunk_heap_new(buffer.s, buffer.s->val, buffer.s->len); + chunk = php_cli_server_chunk_heap_new(buffer.s, ZSTR_VAL(buffer.s), ZSTR_LEN(buffer.s)); if (!chunk) { smart_str_free(&buffer); php_cli_server_log_response(client, 500, NULL); @@ -2212,7 +2212,7 @@ static int php_cli_server_ctor(php_cli_server *server, const char *addr, const c server_sock = php_network_listen_socket(host, &port, SOCK_STREAM, &server->address_family, &server->socklen, &errstr); if (server_sock == SOCK_ERR) { - php_cli_server_logf("Failed to listen on %s:%d (reason: %s)", host, port, errstr ? errstr->val : "?"); + php_cli_server_logf("Failed to listen on %s:%d (reason: %s)", host, port, errstr ? ZSTR_VAL(errstr) : "?"); if (errstr) { zend_string_release(errstr); } diff --git a/sapi/fpm/fpm/fpm_php.c b/sapi/fpm/fpm/fpm_php.c index 9ddc45e5b9..e20276974d 100644 --- a/sapi/fpm/fpm/fpm_php.c +++ b/sapi/fpm/fpm/fpm_php.c @@ -275,7 +275,7 @@ char* fpm_php_get_string_from_table(zend_string *table, char *key) /* {{{ */ } ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(data), str, tmp) { - if (str && !strncmp(str->val, key, str->len)) { + if (str && !strncmp(ZSTR_VAL(str), key, ZSTR_LEN(str))) { return Z_STRVAL_P(tmp); } } ZEND_HASH_FOREACH_END(); diff --git a/sapi/fpm/fpm/fpm_status.c b/sapi/fpm/fpm/fpm_status.c index 7a8a7825c6..3e82face3c 100644 --- a/sapi/fpm/fpm/fpm_status.c +++ b/sapi/fpm/fpm/fpm_status.c @@ -422,7 +422,7 @@ int fpm_status_handle_request(void) /* {{{ */ query_string = proc.query_string; } else { tmp_query_string = php_escape_html_entities_ex((unsigned char *)proc.query_string, strlen(proc.query_string), 1, ENT_HTML_IGNORE_ERRORS & ENT_COMPAT, NULL, 1); - query_string = tmp_query_string->val; + query_string = ZSTR_VAL(tmp_query_string); } } diff --git a/sapi/phpdbg/phpdbg.c b/sapi/phpdbg/phpdbg.c index 951c17c9dd..339102c052 100644 --- a/sapi/phpdbg/phpdbg.c +++ b/sapi/phpdbg/phpdbg.c @@ -57,7 +57,7 @@ static PHP_INI_MH(OnUpdateEol) return FAILURE; } - return phpdbg_eol_global_update(new_value->val); + return phpdbg_eol_global_update(ZSTR_VAL(new_value)); } PHP_INI_BEGIN() @@ -287,7 +287,7 @@ static PHP_FUNCTION(phpdbg_exec) zend_stat_t sb; zend_bool result = 1; - if (VCWD_STAT(exec->val, &sb) != FAILURE) { + if (VCWD_STAT(ZSTR_VAL(exec), &sb) != FAILURE) { if (sb.st_mode & (S_IFREG|S_IFLNK)) { if (PHPDBG_G(exec)) { ZVAL_STRINGL(return_value, PHPDBG_G(exec), PHPDBG_G(exec_len)); @@ -295,8 +295,8 @@ static PHP_FUNCTION(phpdbg_exec) result = 0; } - PHPDBG_G(exec) = estrndup(exec->val, exec->len); - PHPDBG_G(exec_len) = exec->len; + PHPDBG_G(exec) = estrndup(ZSTR_VAL(exec), ZSTR_LEN(exec)); + PHPDBG_G(exec_len) = ZSTR_LEN(exec); if (result) { ZVAL_TRUE(return_value); @@ -503,7 +503,7 @@ static PHP_FUNCTION(phpdbg_end_oplog) if (last_scope == NULL) { fn_name = zend_string_copy(last_function); } else { - fn_name = strpprintf(last_function->len + last_scope->name->len + 2, "%.*s::%.*s", last_function->len, last_function->val, last_scope->name->len, last_scope->name->val); + fn_name = strpprintf(ZSTR_LEN(last_function) + ZSTR_LEN(last_scope->name) + 2, "%.*s::%.*s", ZSTR_LEN(last_function), ZSTR_VAL(last_function), ZSTR_LEN(last_scope->name), ZSTR_VAL(last_scope->name)); } fn_buf = zend_hash_find(Z_ARR_P(return_value), fn_name); if (!fn_buf) { diff --git a/sapi/phpdbg/phpdbg_bp.c b/sapi/phpdbg/phpdbg_bp.c index 2e40e49d9b..1c06646f0e 100644 --- a/sapi/phpdbg/phpdbg_bp.c +++ b/sapi/phpdbg/phpdbg_bp.c @@ -284,7 +284,7 @@ PHPDBG_API void phpdbg_set_breakpoint_file(const char *path, long line_num) /* { phpdbg_debug("Compare against loaded %s\n", file); - if (!(pending = ((fileht = phpdbg_resolve_pending_file_break_ex(file->val, file->len, path_str, broken)) == NULL))) { + if (!(pending = ((fileht = phpdbg_resolve_pending_file_break_ex(ZSTR_VAL(file), ZSTR_LEN(file), path_str, broken)) == NULL))) { new_break = *(phpdbg_breakfile_t *) zend_hash_index_find_ptr(broken, line_num); break; } @@ -308,9 +308,9 @@ PHPDBG_API void phpdbg_set_breakpoint_file(const char *path, long line_num) /* { PHPDBG_API HashTable *phpdbg_resolve_pending_file_break_ex(const char *file, uint filelen, zend_string *cur, HashTable *fileht) /* {{{ */ { - phpdbg_debug("file: %s, filelen: %u, cur: %s, curlen %u, pos: %c, memcmp: %d\n", file, filelen, cur->val, cur->len, filelen > cur->len ? file[filelen - cur->len - 1] : '?', filelen > cur->len ? memcmp(file + filelen - cur->len, cur->val, cur->len) : 0); + phpdbg_debug("file: %s, filelen: %u, cur: %s, curlen %u, pos: %c, memcmp: %d\n", file, filelen, ZSTR_VAL(cur), ZSTR_LEN(cur), filelen > ZSTR_LEN(cur) ? file[filelen - ZSTR_LEN(cur) - 1] : '?', filelen > ZSTR_LEN(cur) ? memcmp(file + filelen - ZSTR_LEN(cur), ZSTR_VAL(cur), ZSTR_LEN(cur)) : 0); - if (((cur->len < filelen && file[filelen - cur->len - 1] == '/') || filelen == cur->len) && !memcmp(file + filelen - cur->len, cur->val, cur->len)) { + if (((ZSTR_LEN(cur) < filelen && file[filelen - ZSTR_LEN(cur) - 1] == '/') || filelen == ZSTR_LEN(cur)) && !memcmp(file + filelen - ZSTR_LEN(cur), ZSTR_VAL(cur), ZSTR_LEN(cur))) { phpdbg_breakfile_t *brake, new_brake; HashTable *master; @@ -529,7 +529,7 @@ PHPDBG_API int phpdbg_resolve_opline_break(phpdbg_breakopline_t *new_break) /* { zend_execute_data *execute_data = EG(current_execute_data); do { zend_op_array *op_array = &execute_data->func->op_array; - if (op_array->function_name == NULL && op_array->scope == NULL && new_break->class_len == op_array->filename->len && !memcmp(op_array->filename->val, new_break->class_name, new_break->class_len)) { + if (op_array->function_name == NULL && op_array->scope == NULL && new_break->class_len == ZSTR_LEN(op_array->filename) && !memcmp(ZSTR_VAL(op_array->filename), new_break->class_name, new_break->class_len)) { if (phpdbg_resolve_op_array_break(new_break, op_array) == SUCCESS) { return SUCCESS; } else { @@ -848,7 +848,7 @@ static inline phpdbg_breakbase_t *phpdbg_find_breakpoint_file(zend_op_array *op_ phpdbg_breakbase_t *brake; size_t path_len; char realpath[MAXPATHLEN]; - const char *path = op_array->filename->val; + const char *path = ZSTR_VAL(op_array->filename); if (VCWD_REALPATH(path, realpath)) { path = realpath; @@ -889,8 +889,8 @@ static inline phpdbg_breakbase_t *phpdbg_find_breakpoint_symbol(zend_function *f } if (ops->function_name) { - fname = ops->function_name->val; - flen = ops->function_name->len; + fname = ZSTR_VAL(ops->function_name); + flen = ZSTR_LEN(ops->function_name); } else { fname = "main"; flen = 4; @@ -905,8 +905,8 @@ static inline phpdbg_breakbase_t *phpdbg_find_breakpoint_method(zend_op_array *o phpdbg_breakbase_t *brake = NULL; if ((class_table = zend_hash_find_ptr(&PHPDBG_G(bp)[PHPDBG_BREAK_METHOD], ops->scope->name))) { - size_t lcname_len = ops->function_name->len; - char *lcname = zend_str_tolower_dup(ops->function_name->val, lcname_len); + size_t lcname_len = ZSTR_LEN(ops->function_name); + char *lcname = zend_str_tolower_dup(ZSTR_VAL(ops->function_name), lcname_len); brake = zend_hash_str_find_ptr(class_table, lcname, lcname_len); @@ -955,8 +955,8 @@ static inline zend_bool phpdbg_find_breakpoint_param(phpdbg_param_t *param, zend const char *str = NULL; size_t len = 0L; zend_op_array *ops = (zend_op_array*)function; - str = ops->function_name ? ops->function_name->val : "main"; - len = ops->function_name ? ops->function_name->len : strlen(str); + str = ops->function_name ? ZSTR_VAL(ops->function_name) : "main"; + len = ops->function_name ? ZSTR_LEN(ops->function_name) : strlen(str); if (len == param->len && memcmp(param->str, str, len) == SUCCESS) { return param->type == STR_PARAM || execute_data->opline - ops->opcodes == param->num; @@ -986,10 +986,10 @@ static inline zend_bool phpdbg_find_breakpoint_param(phpdbg_param_t *param, zend zend_op_array *ops = (zend_op_array*) function; if (ops->scope) { - size_t lengths[2] = { strlen(param->method.class), ops->scope->name->len }; + size_t lengths[2] = { strlen(param->method.class), ZSTR_LEN(ops->scope->name) }; if (lengths[0] == lengths[1] && memcmp(param->method.class, ops->scope->name, lengths[0]) == SUCCESS) { lengths[0] = strlen(param->method.name); - lengths[1] = ops->function_name->len; + lengths[1] = ZSTR_LEN(ops->function_name); if (lengths[0] == lengths[1] && memcmp(param->method.name, ops->function_name, lengths[0]) == SUCCESS) { return param->type == METHOD_PARAM || (execute_data->opline - ops->opcodes) == param->num; diff --git a/sapi/phpdbg/phpdbg_frame.c b/sapi/phpdbg/phpdbg_frame.c index c2a995dd4a..189b3b20fa 100644 --- a/sapi/phpdbg/phpdbg_frame.c +++ b/sapi/phpdbg/phpdbg_frame.c @@ -148,7 +148,7 @@ static void phpdbg_dump_prototype(zval *tmp) /* {{{ */ if (func->type == ZEND_INTERNAL_FUNCTION) { arg_name = (char *)((zend_internal_arg_info *)&arginfo[j])->name; } else { - arg_name = arginfo[j].name->val; + arg_name = ZSTR_VAL(arginfo[j].name); } } diff --git a/sapi/phpdbg/phpdbg_info.c b/sapi/phpdbg/phpdbg_info.c index 7b957ad540..1f78ac9173 100644 --- a/sapi/phpdbg/phpdbg_info.c +++ b/sapi/phpdbg/phpdbg_info.c @@ -120,7 +120,7 @@ PHPDBG_INFO(constants) /* {{{ */ phpdbg_out("Address Refs Type Constant\n"); ZEND_HASH_FOREACH_PTR(&consts, data) { -#define VARIABLEINFO(attrs, msg, ...) phpdbg_writeln("constant", "address=\"%p\" refcount=\"%d\" type=\"%s\" name=\"%.*s\" " attrs, "%-18p %-7d %-9s %.*s" msg, &data->value, Z_REFCOUNTED(data->value) ? Z_REFCOUNT(data->value) : 1, zend_zval_type_name(&data->value), data->name->len, data->name->val, ##__VA_ARGS__) +#define VARIABLEINFO(attrs, msg, ...) phpdbg_writeln("constant", "address=\"%p\" refcount=\"%d\" type=\"%s\" name=\"%.*s\" " attrs, "%-18p %-7d %-9s %.*s" msg, &data->value, Z_REFCOUNTED(data->value) ? Z_REFCOUNT(data->value) : 1, zend_zval_type_name(&data->value), ZSTR_LEN(data->name), ZSTR_VAL(data->name), ##__VA_ARGS__) switch (Z_TYPE(data->value)) { case IS_STRING: @@ -156,7 +156,7 @@ PHPDBG_INFO(constants) /* {{{ */ static int phpdbg_arm_auto_global(zend_auto_global *auto_global) { if (auto_global->armed) { if (PHPDBG_G(flags) & PHPDBG_IN_SIGNAL_HANDLER) { - phpdbg_notice("variableinfo", "unreachable=\"%.*s\"", "Cannot show information about superglobal variable %.*s", auto_global->name->len, auto_global->name->val); + phpdbg_notice("variableinfo", "unreachable=\"%.*s\"", "Cannot show information about superglobal variable %.*s", ZSTR_LEN(auto_global->name), ZSTR_VAL(auto_global->name)); } else { auto_global->armed = auto_global->auto_global_callback(auto_global->name); } @@ -210,7 +210,7 @@ static int phpdbg_print_symbols(zend_bool show_globals) { } } else { if (ops->filename) { - phpdbg_notice("variableinfo", "file=\"%s\" num=\"%d\"", "Variables in %s (%d)", ops->filename->val, zend_hash_num_elements(&vars)); + phpdbg_notice("variableinfo", "file=\"%s\" num=\"%d\"", "Variables in %s (%d)", ZSTR_VAL(ops->filename), zend_hash_num_elements(&vars)); } else { phpdbg_notice("variableinfo", "opline=\"%p\" num=\"%d\"", "Variables @ %p (%d)", ops, zend_hash_num_elements(&vars)); } @@ -221,7 +221,7 @@ static int phpdbg_print_symbols(zend_bool show_globals) { phpdbg_out("Address Refs Type Variable\n"); ZEND_HASH_FOREACH_STR_KEY_VAL(&vars, var, data) { phpdbg_try_access { -#define VARIABLEINFO(attrs, msg, ...) phpdbg_writeln("variable", "address=\"%p\" refcount=\"%d\" type=\"%s\" refstatus=\"%s\" name=\"%.*s\" " attrs, "%-18p %-7d %-9s %s$%.*s" msg, data, Z_REFCOUNT_P(data), zend_zval_type_name(data), Z_ISREF_P(data) ? "&": "", var->len, var->val, ##__VA_ARGS__) +#define VARIABLEINFO(attrs, msg, ...) phpdbg_writeln("variable", "address=\"%p\" refcount=\"%d\" type=\"%s\" refstatus=\"%s\" name=\"%.*s\" " attrs, "%-18p %-7d %-9s %s$%.*s" msg, data, Z_REFCOUNT_P(data), zend_zval_type_name(data), Z_ISREF_P(data) ? "&": "", ZSTR_LEN(var), ZSTR_VAL(var), ##__VA_ARGS__) switch (Z_TYPE_P(data)) { case IS_RESOURCE: @@ -300,7 +300,7 @@ PHPDBG_INFO(literal) /* {{{ */ } } else { if (ops->filename) { - phpdbg_notice("literalinfo", "file=\"%s\" num=\"%d\"", "Literal Constants in %s (%d)", ops->filename->val, count); + phpdbg_notice("literalinfo", "file=\"%s\" num=\"%d\"", "Literal Constants in %s (%d)", ZSTR_VAL(ops->filename), count); } else { phpdbg_notice("literalinfo", "opline=\"%p\" num=\"%d\"", "Literal Constants @ %p (%d)", ops, count); } @@ -359,7 +359,7 @@ static inline void phpdbg_print_class_name(zend_class_entry *ce) /* {{{ */ const char *visibility = ce->type == ZEND_USER_CLASS ? "User" : "Internal"; const char *type = (ce->ce_flags & ZEND_ACC_INTERFACE) ? "Interface" : (ce->ce_flags & ZEND_ACC_ABSTRACT) ? "Abstract Class" : "Class"; - phpdbg_writeln("class", "type=\"%s\" flags=\"%s\" name=\"%.*s\" methodcount=\"%d\"", "%s %s %.*s (%d)", visibility, type, ce->name->len, ce->name->val, zend_hash_num_elements(&ce->function_table)); + phpdbg_writeln("class", "type=\"%s\" flags=\"%s\" name=\"%.*s\" methodcount=\"%d\"", "%s %s %.*s (%d)", visibility, type, ZSTR_LEN(ce->name), ZSTR_VAL(ce->name), zend_hash_num_elements(&ce->function_table)); } /* }}} */ PHPDBG_INFO(classes) /* {{{ */ @@ -397,7 +397,7 @@ PHPDBG_INFO(classes) /* {{{ */ } if (ce->info.user.filename) { - phpdbg_writeln("classsource", "file=\"%s\" line=\"%u\"", "|---- in %s on line %u", ce->info.user.filename->val, ce->info.user.line_start); + phpdbg_writeln("classsource", "file=\"%s\" line=\"%u\"", "|---- in %s on line %u", ZSTR_VAL(ce->info.user.filename), ce->info.user.line_start); } else { phpdbg_writeln("classsource", "", "|---- no source code"); } @@ -430,10 +430,10 @@ PHPDBG_INFO(funcs) /* {{{ */ ZEND_HASH_FOREACH_PTR(&functions, zf) { zend_op_array *op_array = &zf->op_array; - phpdbg_write("function", "name=\"%s\"", "|-------- %s", op_array->function_name ? op_array->function_name->val : "{main}"); + phpdbg_write("function", "name=\"%s\"", "|-------- %s", op_array->function_name ? ZSTR_VAL(op_array->function_name) : "{main}"); if (op_array->filename) { - phpdbg_writeln("functionsource", "file=\"%s\" line=\"%d\"", " in %s on line %d", op_array->filename->val, op_array->line_start); + phpdbg_writeln("functionsource", "file=\"%s\" line=\"%d\"", " in %s on line %d", ZSTR_VAL(op_array->filename), op_array->line_start); } else { phpdbg_writeln("functionsource", "", " (no source code)"); } diff --git a/sapi/phpdbg/phpdbg_list.c b/sapi/phpdbg/phpdbg_list.c index d38495bf9d..38804d551e 100644 --- a/sapi/phpdbg/phpdbg_list.c +++ b/sapi/phpdbg/phpdbg_list.c @@ -129,10 +129,10 @@ void phpdbg_list_file(zend_string *filename, uint count, int offset, uint highli char resolved_path_buf[MAXPATHLEN]; const char *abspath; - if (VCWD_REALPATH(filename->val, resolved_path_buf)) { + if (VCWD_REALPATH(ZSTR_VAL(filename), resolved_path_buf)) { abspath = resolved_path_buf; } else { - abspath = filename->val; + abspath = ZSTR_VAL(filename); } if (!(data = zend_hash_str_find_ptr(&PHPDBG_G(file_sources), abspath, strlen(abspath)))) { @@ -181,7 +181,7 @@ void phpdbg_list_function(const zend_function *fbc) /* {{{ */ const zend_op_array *ops; if (fbc->type != ZEND_USER_FUNCTION) { - phpdbg_error("list", "type=\"internalfunction\" function=\"%s\"", "The function requested (%s) is not user defined", fbc->common.function_name->val); + phpdbg_error("list", "type=\"internalfunction\" function=\"%s\"", "The function requested (%s) is not user defined", ZSTR_VAL(fbc->common.function_name)); return; } @@ -235,7 +235,7 @@ zend_op_array *phpdbg_compile_file(zend_file_handle *file, int type) { phpdbg_file_source data, *dataptr; zend_file_handle fake = {{0}}; zend_op_array *ret; - char *filename = (char *)(file->opened_path ? file->opened_path->val : file->filename); + char *filename = (char *)(file->opened_path ? ZSTR_VAL(file->opened_path) : file->filename); uint line; char *bufptr, *endptr; char resolved_path_buf[MAXPATHLEN]; diff --git a/sapi/phpdbg/phpdbg_opcode.c b/sapi/phpdbg/phpdbg_opcode.c index 75009108a2..8adbbba36f 100644 --- a/sapi/phpdbg/phpdbg_opcode.c +++ b/sapi/phpdbg/phpdbg_opcode.c @@ -34,7 +34,7 @@ static inline char *phpdbg_decode_op(zend_op_array *ops, znode_op *op, uint32_t switch (type &~ EXT_TYPE_UNUSED) { case IS_CV: { zend_string *var = ops->vars[EX_VAR_TO_NUM(op->var)]; - asprintf(&decode, "$%.*s%c", var->len <= 19 ? (int) var->len : 18, var->val, var->len <= 19 ? 0 : '+'); + asprintf(&decode, "$%.*s%c", ZSTR_LEN(var) <= 19 ? (int) ZSTR_LEN(var) : 18, ZSTR_VAL(var), ZSTR_LEN(var) <= 19 ? 0 : '+'); } break; case IS_VAR: @@ -158,7 +158,7 @@ void phpdbg_print_opline_ex(zend_execute_data *execute_data, HashTable *vars, ze opline, phpdbg_decode_opcode(opline->opcode), decode, - execute_data->func->op_array.filename ? execute_data->func->op_array.filename->val : "unknown"); + execute_data->func->op_array.filename ? ZSTR_VAL(execute_data->func->op_array.filename) : "unknown"); } if (!ignore_flags && PHPDBG_G(oplog)) { @@ -167,7 +167,7 @@ void phpdbg_print_opline_ex(zend_execute_data *execute_data, HashTable *vars, ze opline, phpdbg_decode_opcode(opline->opcode), decode, - execute_data->func->op_array.filename ? execute_data->func->op_array.filename->val : "unknown"); + execute_data->func->op_array.filename ? ZSTR_VAL(execute_data->func->op_array.filename) : "unknown"); } if (decode) { diff --git a/sapi/phpdbg/phpdbg_out.c b/sapi/phpdbg/phpdbg_out.c index 3fa421ad33..cd9a4acaa0 100644 --- a/sapi/phpdbg/phpdbg_out.c +++ b/sapi/phpdbg/phpdbg_out.c @@ -1032,8 +1032,8 @@ static int phpdbg_process_print(int fd, int type, const char *tag, const char *m PHPDBG_G(in_script_xml) = type; } encoded = php_escape_html_entities((unsigned char *) msg, msglen, 0, ENT_NOQUOTES, PG(internal_encoding) && PG(internal_encoding)[0] ? PG(internal_encoding) : (SG(default_charset) ? SG(default_charset) : "UTF-8")); - buflen = encoded->len; - memcpy(buf = emalloc(buflen + 1), encoded->val, buflen); + buflen = ZSTR_LEN(encoded); + memcpy(buf = emalloc(buflen + 1), ZSTR_VAL(encoded), buflen); phpdbg_encode_ctrl_chars(&buf, &buflen); phpdbg_mixed_write(fd, buf, buflen); efree(buf); diff --git a/sapi/phpdbg/phpdbg_print.c b/sapi/phpdbg/phpdbg_print.c index 4013c0fd88..70b8c2f807 100644 --- a/sapi/phpdbg/phpdbg_print.c +++ b/sapi/phpdbg/phpdbg_print.c @@ -66,17 +66,17 @@ static inline void phpdbg_print_function_helper(zend_function *method) /* {{{ */ phpdbg_writeln("printoplineinfo", "type=\"User\" startline=\"%d\" endline=\"%d\" method=\"%s::%s\" file=\"%s\" opline=\"%p\"", "L%d-%d %s::%s() %s - %p + %d ops", op_array->line_start, op_array->line_end, - method->common.scope->name->val, - method->common.function_name->val, - op_array->filename ? op_array->filename->val : "unknown", + ZSTR_VAL(method->common.scope->name), + ZSTR_VAL(method->common.function_name), + op_array->filename ? ZSTR_VAL(op_array->filename) : "unknown", opline, op_array->last); } else { phpdbg_writeln("printoplineinfo", "type=\"User\" startline=\"%d\" endline=\"%d\" function=\"%s\" file=\"%s\" opline=\"%p\"", "L%d-%d %s() %s - %p + %d ops", op_array->line_start, op_array->line_end, - method->common.function_name ? method->common.function_name->val : "{main}", - op_array->filename ? op_array->filename->val : "unknown", + method->common.function_name ? ZSTR_VAL(method->common.function_name) : "{main}", + op_array->filename ? ZSTR_VAL(op_array->filename) : "unknown", opline, op_array->last); } @@ -102,9 +102,9 @@ static inline void phpdbg_print_function_helper(zend_function *method) /* {{{ */ default: { if (method->common.scope) { - phpdbg_writeln("printoplineinfo", "type=\"Internal\" method=\"%s::%s\"", "\tInternal %s::%s()", method->common.scope->name->val, method->common.function_name->val); + phpdbg_writeln("printoplineinfo", "type=\"Internal\" method=\"%s::%s\"", "\tInternal %s::%s()", ZSTR_VAL(method->common.scope->name), ZSTR_VAL(method->common.function_name)); } else { - phpdbg_writeln("printoplineinfo", "type=\"Internal\" function=\"%s\"", "\tInternal %s()", method->common.function_name->val); + phpdbg_writeln("printoplineinfo", "type=\"Internal\" function=\"%s\"", "\tInternal %s()", ZSTR_VAL(method->common.function_name)); } } } @@ -135,13 +135,13 @@ PHPDBG_PRINT(stack) /* {{{ */ zend_op_array *ops = &EG(current_execute_data)->func->op_array; if (ops->function_name) { if (ops->scope) { - phpdbg_notice("printinfo", "method=\"%s::%s\" num=\"%d\"", "Stack in %s::%s() (%d ops)", ops->scope->name->val, ops->function_name->val, ops->last); + phpdbg_notice("printinfo", "method=\"%s::%s\" num=\"%d\"", "Stack in %s::%s() (%d ops)", ZSTR_VAL(ops->scope->name), ZSTR_VAL(ops->function_name), ops->last); } else { - phpdbg_notice("printinfo", "function=\"%s\" num=\"%d\"", "Stack in %s() (%d ops)", ops->function_name->val, ops->last); + phpdbg_notice("printinfo", "function=\"%s\" num=\"%d\"", "Stack in %s() (%d ops)", ZSTR_VAL(ops->function_name), ops->last); } } else { if (ops->filename) { - phpdbg_notice("printinfo", "file=\"%s\" num=\"%d\"", "Stack in %s (%d ops)", ops->filename->val, ops->last); + phpdbg_notice("printinfo", "file=\"%s\" num=\"%d\"", "Stack in %s (%d ops)", ZSTR_VAL(ops->filename), ops->last); } else { phpdbg_notice("printinfo", "opline=\"%p\" num=\"%d\"", "Stack @ %p (%d ops)", ops, ops->last); } @@ -167,7 +167,7 @@ PHPDBG_PRINT(class) /* {{{ */ (ce->ce_flags & ZEND_ACC_ABSTRACT) ? "Abstract Class" : "Class", - ce->name->val, + ZSTR_VAL(ce->name), zend_hash_num_elements(&ce->function_table)); phpdbg_xml("<printmethods %r>"); @@ -195,12 +195,12 @@ PHPDBG_PRINT(method) /* {{{ */ if (phpdbg_safe_class_lookup(param->method.class, strlen(param->method.class), &ce) == SUCCESS) { zend_function *fbc; zend_string *lcname = zend_string_alloc(strlen(param->method.name), 0); - zend_str_tolower_copy(lcname->val, param->method.name, lcname->len); + zend_str_tolower_copy(ZSTR_VAL(lcname), param->method.name, ZSTR_LEN(lcname)); if ((fbc = zend_hash_find_ptr(&ce->function_table, lcname))) { phpdbg_notice("printinfo", "type=\"%s\" flags=\"Method\" symbol=\"%s\" num=\"%d\"", "%s Method %s (%d ops)", (fbc->type == ZEND_USER_FUNCTION) ? "User" : "Internal", - fbc->common.function_name->val, + ZSTR_VAL(fbc->common.function_name), (fbc->type == ZEND_USER_FUNCTION) ? fbc->op_array.last : 0); phpdbg_print_function_helper(fbc); @@ -242,14 +242,14 @@ PHPDBG_PRINT(func) /* {{{ */ } lcname = zend_string_alloc(func_name_len, 0); - zend_str_tolower_copy(lcname->val, func_name, lcname->len); + zend_str_tolower_copy(ZSTR_VAL(lcname), func_name, ZSTR_LEN(lcname)); phpdbg_try_access { if ((fbc = zend_hash_find_ptr(func_table, lcname))) { phpdbg_notice("printinfo", "type=\"%s\" flags=\"%s\" symbol=\"%s\" num=\"%d\"", "%s %s %s (%d ops)", (fbc->type == ZEND_USER_FUNCTION) ? "User" : "Internal", (fbc->common.scope) ? "Method" : "Function", - fbc->common.function_name->val, + ZSTR_VAL(fbc->common.function_name), (fbc->type == ZEND_USER_FUNCTION) ? fbc->op_array.last : 0); phpdbg_print_function_helper(fbc); @@ -320,7 +320,7 @@ void phpdbg_print_opcodes_class(const char *class) { (ce->ce_flags & ZEND_ACC_ABSTRACT) ? "abstract Class" : "class", - ce->name->val); + ZSTR_VAL(ce->name)); if (ce->type != ZEND_USER_CLASS) { return; @@ -333,7 +333,7 @@ void phpdbg_print_opcodes_class(const char *class) { } else { phpdbg_out(", "); } - phpdbg_out("%s", method->common.function_name->val); + phpdbg_out("%s", ZSTR_VAL(method->common.function_name)); } ZEND_HASH_FOREACH_END(); if (first) { phpdbg_out("-"); @@ -364,14 +364,14 @@ PHPDBG_API void phpdbg_print_opcodes(char *function) ZEND_HASH_FOREACH_STR_KEY_PTR(EG(function_table), name, func) { if (func->type == ZEND_USER_FUNCTION) { phpdbg_out("\n"); - phpdbg_print_opcodes_function(name->val, name->len); + phpdbg_print_opcodes_function(ZSTR_VAL(name), ZSTR_LEN(name)); } } ZEND_HASH_FOREACH_END(); ZEND_HASH_FOREACH_STR_KEY_PTR(EG(class_table), name, ce) { if (ce->type == ZEND_USER_CLASS) { phpdbg_out("\n\n"); - phpdbg_print_opcodes_class(name->val); + phpdbg_print_opcodes_class(ZSTR_VAL(name)); } } ZEND_HASH_FOREACH_END(); } else if ((method_name = strtok(NULL, ":")) == NULL) { diff --git a/sapi/phpdbg/phpdbg_prompt.c b/sapi/phpdbg/phpdbg_prompt.c index 71de3a2f7b..db44a2ef32 100644 --- a/sapi/phpdbg/phpdbg_prompt.c +++ b/sapi/phpdbg/phpdbg_prompt.c @@ -608,11 +608,11 @@ static inline void phpdbg_handle_exception(void) /* {{{ */ fci.params = NULL; fci.no_separation = 1; if (zend_call_function(&fci, NULL) == SUCCESS) { - phpdbg_writeln("exception", "name=\"%s\" trace=\"%.*s\"", "Uncaught %s!\n%.*s", ex->ce->name->val, Z_STRLEN(trace), Z_STRVAL(trace)); + phpdbg_writeln("exception", "name=\"%s\" trace=\"%.*s\"", "Uncaught %s!\n%.*s", ZSTR_VAL(ex->ce->name), Z_STRLEN(trace), Z_STRVAL(trace)); zval_ptr_dtor(&trace); } else { - phpdbg_error("exception", "name=\"%s\"", "Uncaught %s!", ex->ce->name->val); + phpdbg_error("exception", "name=\"%s\"", "Uncaught %s!", ZSTR_VAL(ex->ce->name)); } /* output useful information about address */ @@ -1467,7 +1467,7 @@ void phpdbg_execute_ex(zend_execute_data *execute_data) /* {{{ */ file = zval_get_string(zend_read_property(zend_get_exception_base(&zv), &zv, ZEND_STRL("file"), 1, &rv)); line = zval_get_long(zend_read_property(zend_get_exception_base(&zv), &zv, ZEND_STRL("line"), 1, &rv)); - phpdbg_error("exception", "name=\"%s\" file=\"%s\" line=\"%lld\"", "Uncaught exception %s in %s on line %lld", exception->ce->name->val, file->val, line); + phpdbg_error("exception", "name=\"%s\" file=\"%s\" line=\"%lld\"", "Uncaught exception %s in %s on line %lld", ZSTR_VAL(exception->ce->name), ZSTR_VAL(file), line); zend_string_release(file); DO_INTERACTIVE(1); } diff --git a/sapi/phpdbg/phpdbg_utils.c b/sapi/phpdbg/phpdbg_utils.c index 0d03c3cdd4..112f340d6b 100644 --- a/sapi/phpdbg/phpdbg_utils.c +++ b/sapi/phpdbg/phpdbg_utils.c @@ -167,12 +167,12 @@ PHPDBG_API const zend_function *phpdbg_get_function(const char *fname, const cha { zend_function *func = NULL; zend_string *lfname = zend_string_alloc(strlen(fname), 0); - memcpy(lfname->val, zend_str_tolower_dup(fname, lfname->len), lfname->len + 1); + memcpy(ZSTR_VAL(lfname), zend_str_tolower_dup(fname, ZSTR_LEN(lfname)), ZSTR_LEN(lfname) + 1); if (cname) { zend_class_entry *ce; zend_string *lcname = zend_string_alloc(strlen(cname), 0); - memcpy(lcname->val, zend_str_tolower_dup(cname, lcname->len), lcname->len + 1); + memcpy(ZSTR_VAL(lcname), zend_str_tolower_dup(cname, ZSTR_LEN(lcname)), ZSTR_LEN(lcname) + 1); ce = zend_lookup_class(lcname); efree(lcname); @@ -457,8 +457,8 @@ PHPDBG_API int phpdbg_parse_variable_with_arg(char *input, size_t len, HashTable char *name; char *keyname = estrndup(last_index, index_len); if (strkey) { - key = strkey->val; - keylen = strkey->len; + key = ZSTR_VAL(strkey); + keylen = ZSTR_LEN(strkey); } else { keylen = spprintf(&key, 0, "%llu", numkey); } @@ -573,7 +573,7 @@ static int phpdbg_xml_array_element_dump(zval *zv, zend_string *key, zend_ulong phpdbg_try_access { if (key) { /* string key */ - phpdbg_xml(" name=\"%.*s\"", key->len, key->val); + phpdbg_xml(" name=\"%.*s\"", ZSTR_LEN(key), ZSTR_VAL(key)); } else { /* numeric key */ phpdbg_xml(" name=\"%ld\"", num); } @@ -607,7 +607,7 @@ static int phpdbg_xml_object_property_dump(zval *zv, zend_string *key, zend_ulon phpdbg_xml(" class=\"%s\" protection=\"private\"", class_name); } } else { - phpdbg_xml(" name=\"%.*s\" protection=\"public\"", key->len, key->val); + phpdbg_xml(" name=\"%.*s\" protection=\"public\"", ZSTR_LEN(key), ZSTR_VAL(key)); } } else { /* numeric key */ phpdbg_xml(" name=\"%ld\" protection=\"public\"", num); @@ -681,7 +681,7 @@ PHPDBG_API void phpdbg_xml_var_dump(zval *zv) { } class_name = Z_OBJ_HANDLER_P(zv, get_class_name)(Z_OBJ_P(zv)); - phpdbg_xml("<object refstatus=\"%s\" class=\"%.*s\" id=\"%d\" num=\"%d\">", COMMON, class_name->len, class_name->val, Z_OBJ_HANDLE_P(zv), myht ? zend_hash_num_elements(myht) : 0); + phpdbg_xml("<object refstatus=\"%s\" class=\"%.*s\" id=\"%d\" num=\"%d\">", COMMON, ZSTR_LEN(class_name), ZSTR_VAL(class_name), Z_OBJ_HANDLE_P(zv), myht ? zend_hash_num_elements(myht) : 0); zend_string_release(class_name); element_dump_func = phpdbg_xml_object_property_dump; @@ -784,12 +784,12 @@ char *phpdbg_short_zval_print(zval *zv, int maxlen) /* {{{ */ case IS_STRING: { int i; zend_string *str = php_addcslashes(Z_STR_P(zv), 0, "\\\"", 2); - for (i = 0; i < str->len; i++) { - if (str->val[i] < 32) { - str->val[i] = ' '; + for (i = 0; i < ZSTR_LEN(str); i++) { + if (ZSTR_VAL(str)[i] < 32) { + ZSTR_VAL(str)[i] = ' '; } } - asprintf(&decode, "\"%.*s\"%c", str->len <= maxlen - 2 ? (int) str->len : (maxlen - 3), str->val, str->len <= maxlen - 2 ? 0 : '+'); + asprintf(&decode, "\"%.*s\"%c", ZSTR_LEN(str) <= maxlen - 2 ? (int) ZSTR_LEN(str) : (maxlen - 3), ZSTR_VAL(str), ZSTR_LEN(str) <= maxlen - 2 ? 0 : '+'); zend_string_release(str); } break; case IS_RESOURCE: @@ -800,7 +800,7 @@ char *phpdbg_short_zval_print(zval *zv, int maxlen) /* {{{ */ break; case IS_OBJECT: { zend_string *str = Z_OBJCE_P(zv)->name; - asprintf(&decode, "%.*s%c", str->len <= maxlen ? (int) str->len : maxlen - 1, str->val, str->len <= maxlen ? 0 : '+'); + asprintf(&decode, "%.*s%c", ZSTR_LEN(str) <= maxlen ? (int) ZSTR_LEN(str) : maxlen - 1, ZSTR_VAL(str), ZSTR_LEN(str) <= maxlen ? 0 : '+'); break; } case IS_CONSTANT: diff --git a/sapi/phpdbg/phpdbg_wait.c b/sapi/phpdbg/phpdbg_wait.c index d633778de1..856f6e2b3e 100644 --- a/sapi/phpdbg/phpdbg_wait.c +++ b/sapi/phpdbg/phpdbg_wait.c @@ -36,7 +36,7 @@ static void phpdbg_rebuild_http_globals_array(int type, const char *name) { static int phpdbg_dearm_autoglobals(zend_auto_global *auto_global) { - if (auto_global->name->len != sizeof("GLOBALS") - 1 || memcmp(auto_global->name->val, "GLOBALS", sizeof("GLOBALS") - 1)) { + if (ZSTR_LEN(auto_global->name) != sizeof("GLOBALS") - 1 || memcmp(ZSTR_VAL(auto_global->name), "GLOBALS", sizeof("GLOBALS") - 1)) { auto_global->armed = 0; } diff --git a/sapi/phpdbg/phpdbg_watch.c b/sapi/phpdbg/phpdbg_watch.c index 49f8885b90..7452771cf2 100644 --- a/sapi/phpdbg/phpdbg_watch.c +++ b/sapi/phpdbg/phpdbg_watch.c @@ -463,7 +463,7 @@ static int phpdbg_create_recursive_ht_watch(phpdbg_watchpoint_t *watch) { efree(str); } - str_len = spprintf(&str, 0, "%.*s%s%s%s", (int) watch->str->len - 2, watch->str->val, (watch->flags & PHPDBG_WATCH_ARRAY) ? "[" : "->", phpdbg_get_property_key(new_watch->name_in_parent->val), (watch->flags & PHPDBG_WATCH_ARRAY) ? "]" : ""); + str_len = spprintf(&str, 0, "%.*s%s%s%s", (int) ZSTR_LEN(watch->str) - 2, ZSTR_VAL(watch->str), (watch->flags & PHPDBG_WATCH_ARRAY) ? "[" : "->", phpdbg_get_property_key(ZSTR_VAL(new_watch->name_in_parent)), (watch->flags & PHPDBG_WATCH_ARRAY) ? "]" : ""); new_watch->str = zend_string_init(str, str_len, 0); efree(str); @@ -498,7 +498,7 @@ static int phpdbg_create_recursive_zval_watch(phpdbg_watchpoint_t *watch) { new_watch->parent_container = watch->parent_container; new_watch->name_in_parent = watch->name_in_parent; ++GC_REFCOUNT(new_watch->name_in_parent); - str_len = spprintf(&str, 0, "%.*s[]", (int) watch->str->len, watch->str->val); + str_len = spprintf(&str, 0, "%.*s[]", (int) ZSTR_LEN(watch->str), ZSTR_VAL(watch->str)); new_watch->str = zend_string_init(str, str_len, 0); efree(str); @@ -572,9 +572,9 @@ static void phpdbg_delete_ht_watchpoints_recursive(phpdbg_watchpoint_t *watch) { ZEND_HASH_FOREACH_KEY(HT_WATCH_HT(watch), numkey, strkey) { if (strkey) { - str_len = spprintf(&str, 0, "%.*s%s%s%s", (int) watch->str->len, watch->str->val, (watch->flags & PHPDBG_WATCH_ARRAY) ? "[" : "->", phpdbg_get_property_key(strkey->val), (watch->flags & PHPDBG_WATCH_ARRAY) ? "]" : ""); + str_len = spprintf(&str, 0, "%.*s%s%s%s", (int) ZSTR_LEN(watch->str), ZSTR_VAL(watch->str), (watch->flags & PHPDBG_WATCH_ARRAY) ? "[" : "->", phpdbg_get_property_key(ZSTR_VAL(strkey)), (watch->flags & PHPDBG_WATCH_ARRAY) ? "]" : ""); } else { - str_len = spprintf(&str, 0, "%.*s%s" ZEND_LONG_FMT "%s", (int) watch->str->len, watch->str->val, (watch->flags & PHPDBG_WATCH_ARRAY) ? "[" : "->", numkey, (watch->flags & PHPDBG_WATCH_ARRAY) ? "]" : ""); + str_len = spprintf(&str, 0, "%.*s%s" ZEND_LONG_FMT "%s", (int) ZSTR_LEN(watch->str), ZSTR_VAL(watch->str), (watch->flags & PHPDBG_WATCH_ARRAY) ? "[" : "->", numkey, (watch->flags & PHPDBG_WATCH_ARRAY) ? "]" : ""); } if ((watchpoint = zend_hash_str_find_ptr(&PHPDBG_G(watchpoints), str, str_len))) { @@ -761,7 +761,7 @@ void phpdbg_watch_HashTable_dtor(zval *zv) { if (watch->flags & PHPDBG_WATCH_NORMAL) { PHPDBG_G(watchpoint_hit) = 1; - phpdbg_notice("watchdelete", "variable=\"%.*s\" recursive=\"%s\"", "%.*s was removed, removing watchpoint%s", (int) watch->str->len, watch->str->val, (watch->flags & PHPDBG_WATCH_RECURSIVE) ? " recursively" : ""); + phpdbg_notice("watchdelete", "variable=\"%.*s\" recursive=\"%s\"", "%.*s was removed, removing watchpoint%s", (int) ZSTR_LEN(watch->str), ZSTR_VAL(watch->str), (watch->flags & PHPDBG_WATCH_RECURSIVE) ? " recursively" : ""); } if (watch->flags & PHPDBG_WATCH_RECURSIVE) { @@ -979,7 +979,7 @@ static void phpdbg_print_changed_zval(phpdbg_watch_memdump *dump) { if (do_break) { PHPDBG_G(watchpoint_hit) = 1; - phpdbg_notice("watchhit", "variable=\"%s\"", "Breaking on watchpoint %.*s", (int) watch->str->len, watch->str->val); + phpdbg_notice("watchhit", "variable=\"%s\"", "Breaking on watchpoint %.*s", (int) ZSTR_LEN(watch->str), ZSTR_VAL(watch->str)); phpdbg_xml("<watchdata %r>"); } @@ -1003,7 +1003,7 @@ static void phpdbg_print_changed_zval(phpdbg_watch_memdump *dump) { /* check if zval was removed */ if (removed) { if (watch->flags & PHPDBG_WATCH_NORMAL) { - phpdbg_notice("watchdelete", "variable=\"%.*s\"", "Watchpoint %.*s was unset, removing watchpoint", (int) watch->str->len, watch->str->val); + phpdbg_notice("watchdelete", "variable=\"%.*s\"", "Watchpoint %.*s was unset, removing watchpoint", (int) ZSTR_LEN(watch->str), ZSTR_VAL(watch->str)); } zend_hash_del(&PHPDBG_G(watchpoints), watch->str); @@ -1111,7 +1111,7 @@ void phpdbg_list_watchpoints(void) { ZEND_HASH_FOREACH_PTR(&PHPDBG_G(watchpoints), watch) { if (watch->flags & PHPDBG_WATCH_NORMAL) { - phpdbg_writeln("watchvariable", "variable=\"%.*s\" on=\"%s\" type=\"%s\"", "%.*s (%s, %s)", (int) watch->str->len, watch->str->val, watch->type == WATCH_ON_HASHTABLE ? "array" : watch->type == WATCH_ON_REFCOUNTED ? "refcount" : "variable", watch->flags == PHPDBG_WATCH_RECURSIVE ? "recursive" : "simple"); + phpdbg_writeln("watchvariable", "variable=\"%.*s\" on=\"%s\" type=\"%s\"", "%.*s (%s, %s)", (int) ZSTR_LEN(watch->str), ZSTR_VAL(watch->str), watch->type == WATCH_ON_HASHTABLE ? "array" : watch->type == WATCH_ON_REFCOUNTED ? "refcount" : "variable", watch->flags == PHPDBG_WATCH_RECURSIVE ? "recursive" : "simple"); } } ZEND_HASH_FOREACH_END(); @@ -1137,7 +1137,7 @@ void phpdbg_watch_efree(void *ptr) { } if (watch->type == WATCH_ON_HASHTABLE && (watch->flags & PHPDBG_WATCH_SIMPLE)) { /* when a HashTable is freed, we can safely assume the other zvals all were dtor'ed */ - phpdbg_notice("watchdelete", "variable=\"%.*s\" recursive=\"%s\"", "Array %.*s was removed, removing watchpoint%s", (int) watch->str->len, watch->str->val, (watch->flags & PHPDBG_WATCH_RECURSIVE) ? " recursively" : ""); + phpdbg_notice("watchdelete", "variable=\"%.*s\" recursive=\"%s\"", "Array %.*s was removed, removing watchpoint%s", (int) ZSTR_LEN(watch->str), ZSTR_VAL(watch->str), (watch->flags & PHPDBG_WATCH_RECURSIVE) ? " recursively" : ""); } if (watch->type == WATCH_ON_HASHTABLE || watch->parent == NULL || watch->parent->type != WATCH_ON_ZVAL) { /* no references */ zend_hash_del(&PHPDBG_G(watchpoints), watch->str); diff --git a/sapi/phpdbg/phpdbg_webdata_transfer.c b/sapi/phpdbg/phpdbg_webdata_transfer.c index af5847c7f4..ddcf2deec2 100644 --- a/sapi/phpdbg/phpdbg_webdata_transfer.c +++ b/sapi/phpdbg/phpdbg_webdata_transfer.c @@ -167,8 +167,8 @@ PHPDBG_API void phpdbg_webdata_compress(char **msg, int *len) { PHP_VAR_SERIALIZE_INIT(var_hash); php_var_serialize(&buf, &array, &var_hash); PHP_VAR_SERIALIZE_DESTROY(var_hash); - *msg = buf.s->val; - *len = buf.s->len; + *msg = ZSTR_VAL(buf.s); + *len = ZSTR_LEN(buf.s); } zval_dtor(&array); |