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;
}
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);
}
/* }}} */
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 &&
}
}
} 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];
}
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);
}
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);
{
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) {
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");
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();
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();
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",
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;
}
if (!zend_parse_arg_object(arg, p, ce, check_null)) {
if (ce) {
- return ce->name->val;
+ return ZSTR_VAL(ce->name);
} else {
return "object";
}
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 "";
}
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) /* {{{ */
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",
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);
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;
{
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;
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);
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);
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);
/* 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);
}
}
/* }}} */
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);
}
}
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 {
}
}
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));
* 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;
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++;
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);
}
}
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++;
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;
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);
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);
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
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;
{
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")) {
*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;
} 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;
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);
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)) {
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) {
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;
}
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;
}
}
} 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);
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);
*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);
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);
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;
}
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;
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);
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);
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);
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);
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++;
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);
{
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);
{
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':
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:
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);
}
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);
ZEND_PARSE_PARAMETERS_END();
#endif
- RETVAL_LONG(s->len);
+ RETVAL_LONG(ZSTR_LEN(s));
}
/* }}} */
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)));
}
/* }}} */
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));
}
/* }}} */
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)));
}
/* }}} */
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));
}
/* }}} */
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);
}
}
/* 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;
}
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);
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;
}
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) {
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) &&
#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);
}
#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);
}
#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);
}
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);
}
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;
}
}
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;
}
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;
}
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)) {
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;
}
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 {
}
} 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;
}
}
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;
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;
}
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);
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;
}
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;
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;
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);
/* 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;
}
}
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;
}
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();
}
}
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 */
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 ? "&" : "",
/* 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;
}
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;
}
{
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) {
{
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));
}
}
/* }}} */
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;
}
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);
}
/* 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);
}
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 */
return ret;
}
} else {
- after_ns = name->val;
+ after_ns = ZSTR_VAL(name);
}
/* original unqualified constant name */
/* 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;
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;
}
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);
}
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);
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) {
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) {
}
}
- 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);
}
}
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);
&& 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 {
* 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 {
}
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);
/* 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;
}
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;
}
/* }}} */
*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;
}
{
/* 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);
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 {
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);
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);
}
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;
}
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));
}
}
/* }}} */
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);
}
} else {
- zend_error(E_COMPILE_WARNING, "Unsupported declare '%s'", name->val);
+ zend_error(E_COMPILE_WARNING, "Unsupported declare '%s'", ZSTR_VAL(name));
}
}
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;
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");
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;
}
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;
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) {
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));
}
}
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) {
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)) {
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)) {
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;
}
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);
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);
}
/* }}} */
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);
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);
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));
}
}
}
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_error(E_WARNING, "The use statement with non-compound name '%s' "
- "has no effect", new_name->val);
+ "has no effect", ZSTR_VAL(new_name));
}
}
}
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);
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);
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);
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);
) {
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));
}
}
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);
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);
}
/* }}} */
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;
}
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);
}
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));
}
}
}
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;
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! */
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);
}
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] == '\\') {
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;
#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 {
}
/* 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);
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();
}
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;
}
/* }}} */
#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);
}
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);
} 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;
}
} 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;
}
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];
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");
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);
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);
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);
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);
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);
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);
{
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);
}
{
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);
}
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;
}
*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 {
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 = "";
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);
}
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) {
} 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;
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;
}
}
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;
}
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)) {
} 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;
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 {
{
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);
}
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 = "";
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);
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 = "";
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;
}
}
} 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;
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) {
} 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;
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), "");
} 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;
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", "");
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];
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);
} 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));
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) &&
}
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) {
if (space) {
*space = ce ? "::" : "";
}
- return ce ? ce->name->val : "";
+ return ce ? ZSTR_VAL(ce->name) : "";
}
default:
if (space) {
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;
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]";
}
--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);
} 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);
}
}
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) {
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));
}
}
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;
}
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);
}
}
/* 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);
}
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);
}
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;
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;
#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 {
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),
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;
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);
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);
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);
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);
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;
}
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);
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);
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;
}
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;
}
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;
}
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);
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);
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);
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);
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, "::");
}
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");
&& 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;
*/
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) {
/* 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;
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);
}
} 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) {
}
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);
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));
}
}
/* }}} */
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));
}
}
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;
}
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));
}
}
}
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;
/* 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;
}
/* 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 */
/* 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 */
}
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. */
/* 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));
}
}
- 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;
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++) {
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));
}
/* }}} */
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);
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.
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);
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);
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);
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++;
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);
}
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);
/** 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
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));
}
}
}
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)
);
}
/* }}} */
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));
}
}
/* }}} */
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);
}
}
/* }}} */
} 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));
}
}
/* }}} */
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);
}
}
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);
}
}
}
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) {
}
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;
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;
}
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;
}
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;
}
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;
}
/* }}} */
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;
}
p = (double *) (base+(size_t) mh_arg1);
- *p = zend_strtod(new_value->val, NULL);
+ *p = zend_strtod(ZSTR_VAL(new_value), NULL);
return SUCCESS;
}
/* }}} */
p = (char **) (base+(size_t) mh_arg1);
- *p = new_value ? new_value->val : NULL;
+ *p = new_value ? ZSTR_VAL(new_value) : NULL;
return SUCCESS;
}
/* }}} */
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;
}
/* }}} */
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;
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 */
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);
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;
}
}
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;
}
/* }}} */
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) {
/* 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;
}
}
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;
}
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;
}
/* }}} */
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'");
|| 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;
}
} 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;
}
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'");
|| 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;
} 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;
}
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 {
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;
}
(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 {
}
}
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);
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;
}
}
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));
}
}
/* }}} */
}
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;
}
#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);
/* 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 */
/* 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));
}
}
}
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));
}
}
/* }}} */
//??? 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);
}
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)) {
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;
}
}
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;
}
}
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);
/* 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) {
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;
}
}
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;
}
}
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;
}
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;
}
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;
}
/* }}} */
*/
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;
}
}
*/
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;
}
}
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)) {
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;
}
}
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);
}
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);
}
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;
}
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;
}
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;
}
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);
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) { \
{
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;
{
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;
{
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);
}
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:
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));
}
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));
}
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));
}
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
* 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)) {
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);
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);
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);
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);
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));
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;
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++;
/* }}} */
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);
}
/* }}} */
? 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);
}
}
? 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);
/* 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
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;
}
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 {
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;
}
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 {
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);
}
/* 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();
}
/* 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();
}
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));
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);
}
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);
}
}
}
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);
}
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);
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();
}
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();
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;
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();
}
}
}
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);
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();
}
} 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));
}
}
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();
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();
}
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();
/* 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);
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();
}
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();
}
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();
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)
);
}
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);
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);
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");
}
/* 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();
}
/* 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();
}
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);
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();
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();
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;
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;
}
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);
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);
}
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();
}
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);
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;
}
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)) {
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();
}
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();
}
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();
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)
);
}
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);
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);
}
}
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);
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();
}
} 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));
}
}
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();
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();
}
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();
}
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);
}
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);
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();
}
} 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));
}
}
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();
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();
}
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();
}
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);
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();
}
} 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));
}
}
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();
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();
}
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();
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);
}
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");
}
/* 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();
}
/* 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();
}
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);
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();
}
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();
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();
}
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;
}
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)) {
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;
}
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 {
/* 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();
}
/* 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();
}
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));
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);
}
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);
}
}
}
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);
}
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);
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));
}
}
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();
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;
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();
}
}
/* 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);
/* 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();
}
/* 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();
}
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));
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);
/* 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();
}
/* 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();
}
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));
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);
}
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();
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;
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();
}
}
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;
}
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 {
}
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);
}
}
}
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);
}
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);
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));
}
}
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();
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;
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();
}
}
/* 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);
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;
}
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 {
}
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);
}
}
}
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);
}
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);
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);
}
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();
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;
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();
}
}
/* 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);
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();
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();
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();
}
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)) {
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);
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();
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();
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;
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;
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();
}
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)) {
}
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();
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;
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();
}
}
}
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();
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;
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();
}
}
}
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();
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;
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();
}
}
}
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();
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;
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();
}
}
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");
}
/* 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();
}
/* 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();
}
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));
}
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));
}
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);
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);
}
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);
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");
}
/* 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();
}
/* 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();
}
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);
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();
}
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();
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();
}
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;
}
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)) {
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;
}
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 {
/* 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();
}
/* 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();
}
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));
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);
}
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);
}
}
}
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);
}
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);
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));
}
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;
/* 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();
}
/* 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();
}
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));
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);
/* 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();
}
/* 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();
}
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));
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);
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;
}
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 {
}
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);
}
}
}
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);
}
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);
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));
}
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;
}
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 {
}
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);
}
}
}
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);
}
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);
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);
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);
}
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");
}
/* 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();
}
/* 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();
}
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);
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;
}
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;
}
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 {
/* 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();
}
/* 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();
}
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));
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);
}
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);
}
}
}
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);
}
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);
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);
/* 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();
}
/* 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();
}
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));
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);
/* 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();
}
/* 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();
}
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));
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);
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;
}
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 {
}
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);
}
}
}
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);
}
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);
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);
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;
}
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 {
}
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);
}
}
}
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);
}
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);
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);
{
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;
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");
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);
}
}
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);
}
}
}
/* 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) {
}
#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;
}
#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");
}
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)) {
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;
/* 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;
/* 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;
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));
}
/* }}} */
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)));
}
/* }}} */
/* 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;
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;
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;
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;
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;
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;
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;
}
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;
}
}
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;
}
}
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
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;
}
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;
}
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;
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;
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");
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");
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;
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;
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;
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;
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;
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;
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);
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);
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;
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;
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) {
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) {
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;
}
/* }}} */
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;
}
/* }}} */
}
}
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 {
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);
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));
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;
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;
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);
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);
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);
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);
}
/* 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;
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);
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];
/* 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;
}
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 */
/* 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;
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;
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;
}
}
}
- 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;
/* 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;
}
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);
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);
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;
}
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;
}
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;
}
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;
}
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;
}
}
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);
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;
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;
}
}
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++;
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) {
efree(pathbuf);
/* Everything checks out, set it */
- *p = new_value->val;
+ *p = ZSTR_VAL(new_value);
return SUCCESS;
}
*/
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 &&
*/
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) {
{
zend_long i;
- ZEND_ATOL(i, new_value->val);
+ ZEND_ATOL(i, ZSTR_VAL(new_value));
if (i >= 0) {
EG(precision) = i;
return SUCCESS;
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 */
}
{
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;
}
*/
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;
}
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;
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;
}
}
{
/* 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;
}
}
#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 */
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 */
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 */
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));
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;
}
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));
}
} 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)");
}
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");
}
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;
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();
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();
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;
}
}
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 {
}
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;
}
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;
}
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);
}
}
/* }}} */
}
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);
}
}
/* }}} */
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) {
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) {
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(" => ");
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);
}
}
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);
}
}
}
{
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,
}
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;
}
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);
static int unlink_filename(zval *el) /* {{{ */
{
zend_string *filename = Z_STR_P(el);
- VCWD_UNLINK(filename->val);
+ VCWD_UNLINK(ZSTR_VAL(filename));
return 0;
}
/* }}} */
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;
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);
}
((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);
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;
/*
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);
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);
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;
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;
*/
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) {
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 */
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;
}
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) {
}
if (len) {
*ptr = '\0';
- result->len = len;
+ ZSTR_LEN(result) = len;
} else {
zend_string_free(result);
result = NULL;
}
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;
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;
*/
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));
}
/* }}} */
*/
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));
}
/* }}} */
#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; } \
}
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 {
}
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);
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);
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;
}
}
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;
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 {
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);
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);
}
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);
}
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;
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);
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);
}
}
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();
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);
}
}
return FAILURE;
}
- return phpdbg_eol_global_update(new_value->val);
+ return phpdbg_eol_global_update(ZSTR_VAL(new_value));
}
PHP_INI_BEGIN()
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));
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);
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) {
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;
}
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;
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 {
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;
}
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;
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);
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;
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;
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);
}
}
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:
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);
}
}
} 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));
}
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:
}
} 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);
}
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) /* {{{ */
}
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");
}
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)");
}
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)))) {
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;
}
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];
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:
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)) {
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) {
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);
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);
}
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));
}
}
}
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);
}
(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>");
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);
}
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);
(ce->ce_flags & ZEND_ACC_ABSTRACT) ?
"abstract Class" :
"class",
- ce->name->val);
+ ZSTR_VAL(ce->name));
if (ce->type != ZEND_USER_CLASS) {
return;
} 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("-");
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) {
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 */
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);
}
{
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);
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);
}
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);
}
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);
}
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;
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:
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:
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;
}
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);
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);
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))) {
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) {
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>");
}
/* 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);
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();
}
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);
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);