diff options
| author | Dmitry Stogov <dmitry@zend.com> | 2015-06-30 13:59:27 +0300 |
|---|---|---|
| committer | Dmitry Stogov <dmitry@zend.com> | 2015-06-30 13:59:27 +0300 |
| commit | 7aa7627172c11979ec45c2db85f99182812ee59d (patch) | |
| tree | 90762a1d26b47213a9edd7016a9c45110156e24e /sapi | |
| parent | d554d64f649a915b4ecb3a1de409cfc8ff0e9133 (diff) | |
| download | php-git-7aa7627172c11979ec45c2db85f99182812ee59d.tar.gz | |
Use ZSTR_ API to access zend_string elements (this is just renaming without semantick changes).
Diffstat (limited to 'sapi')
| -rw-r--r-- | sapi/cli/php_cli_server.c | 22 | ||||
| -rw-r--r-- | sapi/fpm/fpm/fpm_php.c | 2 | ||||
| -rw-r--r-- | sapi/fpm/fpm/fpm_status.c | 2 | ||||
| -rw-r--r-- | sapi/phpdbg/phpdbg.c | 10 | ||||
| -rw-r--r-- | sapi/phpdbg/phpdbg_bp.c | 26 | ||||
| -rw-r--r-- | sapi/phpdbg/phpdbg_frame.c | 2 | ||||
| -rw-r--r-- | sapi/phpdbg/phpdbg_info.c | 18 | ||||
| -rw-r--r-- | sapi/phpdbg/phpdbg_list.c | 8 | ||||
| -rw-r--r-- | sapi/phpdbg/phpdbg_opcode.c | 6 | ||||
| -rw-r--r-- | sapi/phpdbg/phpdbg_out.c | 4 | ||||
| -rw-r--r-- | sapi/phpdbg/phpdbg_print.c | 38 | ||||
| -rw-r--r-- | sapi/phpdbg/phpdbg_prompt.c | 6 | ||||
| -rw-r--r-- | sapi/phpdbg/phpdbg_utils.c | 24 | ||||
| -rw-r--r-- | sapi/phpdbg/phpdbg_wait.c | 2 | ||||
| -rw-r--r-- | sapi/phpdbg/phpdbg_watch.c | 18 | ||||
| -rw-r--r-- | sapi/phpdbg/phpdbg_webdata_transfer.c | 4 |
16 files changed, 96 insertions, 96 deletions
diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c index d622b099de..f76199af9a 100644 --- a/sapi/cli/php_cli_server.c +++ b/sapi/cli/php_cli_server.c @@ -546,7 +546,7 @@ static int sapi_cli_server_send_headers(sapi_headers_struct *sapi_headers) /* {{ } smart_str_appendl(&buffer, "\r\n", 2); - php_cli_server_client_send_through(client, buffer.s->val, buffer.s->len); + php_cli_server_client_send_through(client, ZSTR_VAL(buffer.s), ZSTR_LEN(buffer.s)); smart_str_free(&buffer); return SAPI_HEADER_SENT_SUCCESSFULLY; @@ -595,8 +595,8 @@ static int sapi_cli_server_register_entry_cb(char **entry, int num_args, va_list if (hash_key->key) { char *real_key, *key; uint i; - key = estrndup(hash_key->key->val, hash_key->key->len); - for(i=0; i<hash_key->key->len; i++) { + key = estrndup(ZSTR_VAL(hash_key->key), ZSTR_LEN(hash_key->key)); + for(i=0; i<ZSTR_LEN(hash_key->key); i++) { if (key[i] == '-') { key[i] = '_'; } else { @@ -1773,8 +1773,8 @@ static int php_cli_server_client_ctor(php_cli_server_client *client, php_cli_ser zend_string *addr_str = 0; php_network_populate_name_from_sockaddr(addr, addr_len, &addr_str, NULL, 0); - client->addr_str = pestrndup(addr_str->val, addr_str->len, 1); - client->addr_str_len = addr_str->len; + client->addr_str = pestrndup(ZSTR_VAL(addr_str), ZSTR_LEN(addr_str), 1); + client->addr_str_len = ZSTR_LEN(addr_str); zend_string_release(addr_str); } php_http_parser_init(&client->parser, PHP_HTTP_REQUEST); @@ -1832,7 +1832,7 @@ static int php_cli_server_send_error_page(php_cli_server *server, php_cli_server if (!chunk) { goto fail; } - snprintf(chunk->data.heap.p, chunk->data.heap.len, prologue_template, status, status_string, escaped_request_uri->val); + snprintf(chunk->data.heap.p, chunk->data.heap.len, prologue_template, status, status_string, ZSTR_VAL(escaped_request_uri)); chunk->data.heap.len = strlen(chunk->data.heap.p); php_cli_server_buffer_append(&client->content_sender.buffer, chunk); } @@ -1852,11 +1852,11 @@ static int php_cli_server_send_error_page(php_cli_server *server, php_cli_server php_cli_server_buffer_append(&client->content_sender.buffer, chunk); } { - php_cli_server_chunk *chunk = php_cli_server_chunk_heap_new_self_contained(strlen(content_template) + escaped_request_uri->len + 3 + strlen(status_string) + 1); + php_cli_server_chunk *chunk = php_cli_server_chunk_heap_new_self_contained(strlen(content_template) + ZSTR_LEN(escaped_request_uri) + 3 + strlen(status_string) + 1); if (!chunk) { goto fail; } - snprintf(chunk->data.heap.p, chunk->data.heap.len, content_template, status_string, escaped_request_uri->val); + snprintf(chunk->data.heap.p, chunk->data.heap.len, content_template, status_string, ZSTR_VAL(escaped_request_uri)); chunk->data.heap.len = strlen(chunk->data.heap.p); php_cli_server_buffer_append(&client->content_sender.buffer, chunk); } @@ -1884,7 +1884,7 @@ static int php_cli_server_send_error_page(php_cli_server *server, php_cli_server smart_str_appendl_ex(&buffer, "\r\n", 2, 1); smart_str_appendl_ex(&buffer, "\r\n", 2, 1); - chunk = php_cli_server_chunk_heap_new(buffer.s, buffer.s->val, buffer.s->len); + chunk = php_cli_server_chunk_heap_new(buffer.s, ZSTR_VAL(buffer.s), ZSTR_LEN(buffer.s)); if (!chunk) { smart_str_free(&buffer); goto fail; @@ -1974,7 +1974,7 @@ static int php_cli_server_begin_send_static(php_cli_server *server, php_cli_serv smart_str_append_unsigned_ex(&buffer, client->request.sb.st_size, 1); smart_str_appendl_ex(&buffer, "\r\n", 2, 1); smart_str_appendl_ex(&buffer, "\r\n", 2, 1); - chunk = php_cli_server_chunk_heap_new(buffer.s, buffer.s->val, buffer.s->len); + chunk = php_cli_server_chunk_heap_new(buffer.s, ZSTR_VAL(buffer.s), ZSTR_LEN(buffer.s)); if (!chunk) { smart_str_free(&buffer); php_cli_server_log_response(client, 500, NULL); @@ -2212,7 +2212,7 @@ static int php_cli_server_ctor(php_cli_server *server, const char *addr, const c server_sock = php_network_listen_socket(host, &port, SOCK_STREAM, &server->address_family, &server->socklen, &errstr); if (server_sock == SOCK_ERR) { - php_cli_server_logf("Failed to listen on %s:%d (reason: %s)", host, port, errstr ? errstr->val : "?"); + php_cli_server_logf("Failed to listen on %s:%d (reason: %s)", host, port, errstr ? ZSTR_VAL(errstr) : "?"); if (errstr) { zend_string_release(errstr); } diff --git a/sapi/fpm/fpm/fpm_php.c b/sapi/fpm/fpm/fpm_php.c index 9ddc45e5b9..e20276974d 100644 --- a/sapi/fpm/fpm/fpm_php.c +++ b/sapi/fpm/fpm/fpm_php.c @@ -275,7 +275,7 @@ char* fpm_php_get_string_from_table(zend_string *table, char *key) /* {{{ */ } ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(data), str, tmp) { - if (str && !strncmp(str->val, key, str->len)) { + if (str && !strncmp(ZSTR_VAL(str), key, ZSTR_LEN(str))) { return Z_STRVAL_P(tmp); } } ZEND_HASH_FOREACH_END(); diff --git a/sapi/fpm/fpm/fpm_status.c b/sapi/fpm/fpm/fpm_status.c index 7a8a7825c6..3e82face3c 100644 --- a/sapi/fpm/fpm/fpm_status.c +++ b/sapi/fpm/fpm/fpm_status.c @@ -422,7 +422,7 @@ int fpm_status_handle_request(void) /* {{{ */ query_string = proc.query_string; } else { tmp_query_string = php_escape_html_entities_ex((unsigned char *)proc.query_string, strlen(proc.query_string), 1, ENT_HTML_IGNORE_ERRORS & ENT_COMPAT, NULL, 1); - query_string = tmp_query_string->val; + query_string = ZSTR_VAL(tmp_query_string); } } diff --git a/sapi/phpdbg/phpdbg.c b/sapi/phpdbg/phpdbg.c index 951c17c9dd..339102c052 100644 --- a/sapi/phpdbg/phpdbg.c +++ b/sapi/phpdbg/phpdbg.c @@ -57,7 +57,7 @@ static PHP_INI_MH(OnUpdateEol) return FAILURE; } - return phpdbg_eol_global_update(new_value->val); + return phpdbg_eol_global_update(ZSTR_VAL(new_value)); } PHP_INI_BEGIN() @@ -287,7 +287,7 @@ static PHP_FUNCTION(phpdbg_exec) zend_stat_t sb; zend_bool result = 1; - if (VCWD_STAT(exec->val, &sb) != FAILURE) { + if (VCWD_STAT(ZSTR_VAL(exec), &sb) != FAILURE) { if (sb.st_mode & (S_IFREG|S_IFLNK)) { if (PHPDBG_G(exec)) { ZVAL_STRINGL(return_value, PHPDBG_G(exec), PHPDBG_G(exec_len)); @@ -295,8 +295,8 @@ static PHP_FUNCTION(phpdbg_exec) result = 0; } - PHPDBG_G(exec) = estrndup(exec->val, exec->len); - PHPDBG_G(exec_len) = exec->len; + PHPDBG_G(exec) = estrndup(ZSTR_VAL(exec), ZSTR_LEN(exec)); + PHPDBG_G(exec_len) = ZSTR_LEN(exec); if (result) { ZVAL_TRUE(return_value); @@ -503,7 +503,7 @@ static PHP_FUNCTION(phpdbg_end_oplog) if (last_scope == NULL) { fn_name = zend_string_copy(last_function); } else { - fn_name = strpprintf(last_function->len + last_scope->name->len + 2, "%.*s::%.*s", last_function->len, last_function->val, last_scope->name->len, last_scope->name->val); + fn_name = strpprintf(ZSTR_LEN(last_function) + ZSTR_LEN(last_scope->name) + 2, "%.*s::%.*s", ZSTR_LEN(last_function), ZSTR_VAL(last_function), ZSTR_LEN(last_scope->name), ZSTR_VAL(last_scope->name)); } fn_buf = zend_hash_find(Z_ARR_P(return_value), fn_name); if (!fn_buf) { diff --git a/sapi/phpdbg/phpdbg_bp.c b/sapi/phpdbg/phpdbg_bp.c index 2e40e49d9b..1c06646f0e 100644 --- a/sapi/phpdbg/phpdbg_bp.c +++ b/sapi/phpdbg/phpdbg_bp.c @@ -284,7 +284,7 @@ PHPDBG_API void phpdbg_set_breakpoint_file(const char *path, long line_num) /* { phpdbg_debug("Compare against loaded %s\n", file); - if (!(pending = ((fileht = phpdbg_resolve_pending_file_break_ex(file->val, file->len, path_str, broken)) == NULL))) { + if (!(pending = ((fileht = phpdbg_resolve_pending_file_break_ex(ZSTR_VAL(file), ZSTR_LEN(file), path_str, broken)) == NULL))) { new_break = *(phpdbg_breakfile_t *) zend_hash_index_find_ptr(broken, line_num); break; } @@ -308,9 +308,9 @@ PHPDBG_API void phpdbg_set_breakpoint_file(const char *path, long line_num) /* { PHPDBG_API HashTable *phpdbg_resolve_pending_file_break_ex(const char *file, uint filelen, zend_string *cur, HashTable *fileht) /* {{{ */ { - phpdbg_debug("file: %s, filelen: %u, cur: %s, curlen %u, pos: %c, memcmp: %d\n", file, filelen, cur->val, cur->len, filelen > cur->len ? file[filelen - cur->len - 1] : '?', filelen > cur->len ? memcmp(file + filelen - cur->len, cur->val, cur->len) : 0); + phpdbg_debug("file: %s, filelen: %u, cur: %s, curlen %u, pos: %c, memcmp: %d\n", file, filelen, ZSTR_VAL(cur), ZSTR_LEN(cur), filelen > ZSTR_LEN(cur) ? file[filelen - ZSTR_LEN(cur) - 1] : '?', filelen > ZSTR_LEN(cur) ? memcmp(file + filelen - ZSTR_LEN(cur), ZSTR_VAL(cur), ZSTR_LEN(cur)) : 0); - if (((cur->len < filelen && file[filelen - cur->len - 1] == '/') || filelen == cur->len) && !memcmp(file + filelen - cur->len, cur->val, cur->len)) { + if (((ZSTR_LEN(cur) < filelen && file[filelen - ZSTR_LEN(cur) - 1] == '/') || filelen == ZSTR_LEN(cur)) && !memcmp(file + filelen - ZSTR_LEN(cur), ZSTR_VAL(cur), ZSTR_LEN(cur))) { phpdbg_breakfile_t *brake, new_brake; HashTable *master; @@ -529,7 +529,7 @@ PHPDBG_API int phpdbg_resolve_opline_break(phpdbg_breakopline_t *new_break) /* { zend_execute_data *execute_data = EG(current_execute_data); do { zend_op_array *op_array = &execute_data->func->op_array; - if (op_array->function_name == NULL && op_array->scope == NULL && new_break->class_len == op_array->filename->len && !memcmp(op_array->filename->val, new_break->class_name, new_break->class_len)) { + if (op_array->function_name == NULL && op_array->scope == NULL && new_break->class_len == ZSTR_LEN(op_array->filename) && !memcmp(ZSTR_VAL(op_array->filename), new_break->class_name, new_break->class_len)) { if (phpdbg_resolve_op_array_break(new_break, op_array) == SUCCESS) { return SUCCESS; } else { @@ -848,7 +848,7 @@ static inline phpdbg_breakbase_t *phpdbg_find_breakpoint_file(zend_op_array *op_ phpdbg_breakbase_t *brake; size_t path_len; char realpath[MAXPATHLEN]; - const char *path = op_array->filename->val; + const char *path = ZSTR_VAL(op_array->filename); if (VCWD_REALPATH(path, realpath)) { path = realpath; @@ -889,8 +889,8 @@ static inline phpdbg_breakbase_t *phpdbg_find_breakpoint_symbol(zend_function *f } if (ops->function_name) { - fname = ops->function_name->val; - flen = ops->function_name->len; + fname = ZSTR_VAL(ops->function_name); + flen = ZSTR_LEN(ops->function_name); } else { fname = "main"; flen = 4; @@ -905,8 +905,8 @@ static inline phpdbg_breakbase_t *phpdbg_find_breakpoint_method(zend_op_array *o phpdbg_breakbase_t *brake = NULL; if ((class_table = zend_hash_find_ptr(&PHPDBG_G(bp)[PHPDBG_BREAK_METHOD], ops->scope->name))) { - size_t lcname_len = ops->function_name->len; - char *lcname = zend_str_tolower_dup(ops->function_name->val, lcname_len); + size_t lcname_len = ZSTR_LEN(ops->function_name); + char *lcname = zend_str_tolower_dup(ZSTR_VAL(ops->function_name), lcname_len); brake = zend_hash_str_find_ptr(class_table, lcname, lcname_len); @@ -955,8 +955,8 @@ static inline zend_bool phpdbg_find_breakpoint_param(phpdbg_param_t *param, zend const char *str = NULL; size_t len = 0L; zend_op_array *ops = (zend_op_array*)function; - str = ops->function_name ? ops->function_name->val : "main"; - len = ops->function_name ? ops->function_name->len : strlen(str); + str = ops->function_name ? ZSTR_VAL(ops->function_name) : "main"; + len = ops->function_name ? ZSTR_LEN(ops->function_name) : strlen(str); if (len == param->len && memcmp(param->str, str, len) == SUCCESS) { return param->type == STR_PARAM || execute_data->opline - ops->opcodes == param->num; @@ -986,10 +986,10 @@ static inline zend_bool phpdbg_find_breakpoint_param(phpdbg_param_t *param, zend zend_op_array *ops = (zend_op_array*) function; if (ops->scope) { - size_t lengths[2] = { strlen(param->method.class), ops->scope->name->len }; + size_t lengths[2] = { strlen(param->method.class), ZSTR_LEN(ops->scope->name) }; if (lengths[0] == lengths[1] && memcmp(param->method.class, ops->scope->name, lengths[0]) == SUCCESS) { lengths[0] = strlen(param->method.name); - lengths[1] = ops->function_name->len; + lengths[1] = ZSTR_LEN(ops->function_name); if (lengths[0] == lengths[1] && memcmp(param->method.name, ops->function_name, lengths[0]) == SUCCESS) { return param->type == METHOD_PARAM || (execute_data->opline - ops->opcodes) == param->num; diff --git a/sapi/phpdbg/phpdbg_frame.c b/sapi/phpdbg/phpdbg_frame.c index c2a995dd4a..189b3b20fa 100644 --- a/sapi/phpdbg/phpdbg_frame.c +++ b/sapi/phpdbg/phpdbg_frame.c @@ -148,7 +148,7 @@ static void phpdbg_dump_prototype(zval *tmp) /* {{{ */ if (func->type == ZEND_INTERNAL_FUNCTION) { arg_name = (char *)((zend_internal_arg_info *)&arginfo[j])->name; } else { - arg_name = arginfo[j].name->val; + arg_name = ZSTR_VAL(arginfo[j].name); } } diff --git a/sapi/phpdbg/phpdbg_info.c b/sapi/phpdbg/phpdbg_info.c index 7b957ad540..1f78ac9173 100644 --- a/sapi/phpdbg/phpdbg_info.c +++ b/sapi/phpdbg/phpdbg_info.c @@ -120,7 +120,7 @@ PHPDBG_INFO(constants) /* {{{ */ phpdbg_out("Address Refs Type Constant\n"); ZEND_HASH_FOREACH_PTR(&consts, data) { -#define VARIABLEINFO(attrs, msg, ...) phpdbg_writeln("constant", "address=\"%p\" refcount=\"%d\" type=\"%s\" name=\"%.*s\" " attrs, "%-18p %-7d %-9s %.*s" msg, &data->value, Z_REFCOUNTED(data->value) ? Z_REFCOUNT(data->value) : 1, zend_zval_type_name(&data->value), data->name->len, data->name->val, ##__VA_ARGS__) +#define VARIABLEINFO(attrs, msg, ...) phpdbg_writeln("constant", "address=\"%p\" refcount=\"%d\" type=\"%s\" name=\"%.*s\" " attrs, "%-18p %-7d %-9s %.*s" msg, &data->value, Z_REFCOUNTED(data->value) ? Z_REFCOUNT(data->value) : 1, zend_zval_type_name(&data->value), ZSTR_LEN(data->name), ZSTR_VAL(data->name), ##__VA_ARGS__) switch (Z_TYPE(data->value)) { case IS_STRING: @@ -156,7 +156,7 @@ PHPDBG_INFO(constants) /* {{{ */ static int phpdbg_arm_auto_global(zend_auto_global *auto_global) { if (auto_global->armed) { if (PHPDBG_G(flags) & PHPDBG_IN_SIGNAL_HANDLER) { - phpdbg_notice("variableinfo", "unreachable=\"%.*s\"", "Cannot show information about superglobal variable %.*s", auto_global->name->len, auto_global->name->val); + phpdbg_notice("variableinfo", "unreachable=\"%.*s\"", "Cannot show information about superglobal variable %.*s", ZSTR_LEN(auto_global->name), ZSTR_VAL(auto_global->name)); } else { auto_global->armed = auto_global->auto_global_callback(auto_global->name); } @@ -210,7 +210,7 @@ static int phpdbg_print_symbols(zend_bool show_globals) { } } else { if (ops->filename) { - phpdbg_notice("variableinfo", "file=\"%s\" num=\"%d\"", "Variables in %s (%d)", ops->filename->val, zend_hash_num_elements(&vars)); + phpdbg_notice("variableinfo", "file=\"%s\" num=\"%d\"", "Variables in %s (%d)", ZSTR_VAL(ops->filename), zend_hash_num_elements(&vars)); } else { phpdbg_notice("variableinfo", "opline=\"%p\" num=\"%d\"", "Variables @ %p (%d)", ops, zend_hash_num_elements(&vars)); } @@ -221,7 +221,7 @@ static int phpdbg_print_symbols(zend_bool show_globals) { phpdbg_out("Address Refs Type Variable\n"); ZEND_HASH_FOREACH_STR_KEY_VAL(&vars, var, data) { phpdbg_try_access { -#define VARIABLEINFO(attrs, msg, ...) phpdbg_writeln("variable", "address=\"%p\" refcount=\"%d\" type=\"%s\" refstatus=\"%s\" name=\"%.*s\" " attrs, "%-18p %-7d %-9s %s$%.*s" msg, data, Z_REFCOUNT_P(data), zend_zval_type_name(data), Z_ISREF_P(data) ? "&": "", var->len, var->val, ##__VA_ARGS__) +#define VARIABLEINFO(attrs, msg, ...) phpdbg_writeln("variable", "address=\"%p\" refcount=\"%d\" type=\"%s\" refstatus=\"%s\" name=\"%.*s\" " attrs, "%-18p %-7d %-9s %s$%.*s" msg, data, Z_REFCOUNT_P(data), zend_zval_type_name(data), Z_ISREF_P(data) ? "&": "", ZSTR_LEN(var), ZSTR_VAL(var), ##__VA_ARGS__) switch (Z_TYPE_P(data)) { case IS_RESOURCE: @@ -300,7 +300,7 @@ PHPDBG_INFO(literal) /* {{{ */ } } else { if (ops->filename) { - phpdbg_notice("literalinfo", "file=\"%s\" num=\"%d\"", "Literal Constants in %s (%d)", ops->filename->val, count); + phpdbg_notice("literalinfo", "file=\"%s\" num=\"%d\"", "Literal Constants in %s (%d)", ZSTR_VAL(ops->filename), count); } else { phpdbg_notice("literalinfo", "opline=\"%p\" num=\"%d\"", "Literal Constants @ %p (%d)", ops, count); } @@ -359,7 +359,7 @@ static inline void phpdbg_print_class_name(zend_class_entry *ce) /* {{{ */ const char *visibility = ce->type == ZEND_USER_CLASS ? "User" : "Internal"; const char *type = (ce->ce_flags & ZEND_ACC_INTERFACE) ? "Interface" : (ce->ce_flags & ZEND_ACC_ABSTRACT) ? "Abstract Class" : "Class"; - phpdbg_writeln("class", "type=\"%s\" flags=\"%s\" name=\"%.*s\" methodcount=\"%d\"", "%s %s %.*s (%d)", visibility, type, ce->name->len, ce->name->val, zend_hash_num_elements(&ce->function_table)); + phpdbg_writeln("class", "type=\"%s\" flags=\"%s\" name=\"%.*s\" methodcount=\"%d\"", "%s %s %.*s (%d)", visibility, type, ZSTR_LEN(ce->name), ZSTR_VAL(ce->name), zend_hash_num_elements(&ce->function_table)); } /* }}} */ PHPDBG_INFO(classes) /* {{{ */ @@ -397,7 +397,7 @@ PHPDBG_INFO(classes) /* {{{ */ } if (ce->info.user.filename) { - phpdbg_writeln("classsource", "file=\"%s\" line=\"%u\"", "|---- in %s on line %u", ce->info.user.filename->val, ce->info.user.line_start); + phpdbg_writeln("classsource", "file=\"%s\" line=\"%u\"", "|---- in %s on line %u", ZSTR_VAL(ce->info.user.filename), ce->info.user.line_start); } else { phpdbg_writeln("classsource", "", "|---- no source code"); } @@ -430,10 +430,10 @@ PHPDBG_INFO(funcs) /* {{{ */ ZEND_HASH_FOREACH_PTR(&functions, zf) { zend_op_array *op_array = &zf->op_array; - phpdbg_write("function", "name=\"%s\"", "|-------- %s", op_array->function_name ? op_array->function_name->val : "{main}"); + phpdbg_write("function", "name=\"%s\"", "|-------- %s", op_array->function_name ? ZSTR_VAL(op_array->function_name) : "{main}"); if (op_array->filename) { - phpdbg_writeln("functionsource", "file=\"%s\" line=\"%d\"", " in %s on line %d", op_array->filename->val, op_array->line_start); + phpdbg_writeln("functionsource", "file=\"%s\" line=\"%d\"", " in %s on line %d", ZSTR_VAL(op_array->filename), op_array->line_start); } else { phpdbg_writeln("functionsource", "", " (no source code)"); } diff --git a/sapi/phpdbg/phpdbg_list.c b/sapi/phpdbg/phpdbg_list.c index d38495bf9d..38804d551e 100644 --- a/sapi/phpdbg/phpdbg_list.c +++ b/sapi/phpdbg/phpdbg_list.c @@ -129,10 +129,10 @@ void phpdbg_list_file(zend_string *filename, uint count, int offset, uint highli char resolved_path_buf[MAXPATHLEN]; const char *abspath; - if (VCWD_REALPATH(filename->val, resolved_path_buf)) { + if (VCWD_REALPATH(ZSTR_VAL(filename), resolved_path_buf)) { abspath = resolved_path_buf; } else { - abspath = filename->val; + abspath = ZSTR_VAL(filename); } if (!(data = zend_hash_str_find_ptr(&PHPDBG_G(file_sources), abspath, strlen(abspath)))) { @@ -181,7 +181,7 @@ void phpdbg_list_function(const zend_function *fbc) /* {{{ */ const zend_op_array *ops; if (fbc->type != ZEND_USER_FUNCTION) { - phpdbg_error("list", "type=\"internalfunction\" function=\"%s\"", "The function requested (%s) is not user defined", fbc->common.function_name->val); + phpdbg_error("list", "type=\"internalfunction\" function=\"%s\"", "The function requested (%s) is not user defined", ZSTR_VAL(fbc->common.function_name)); return; } @@ -235,7 +235,7 @@ zend_op_array *phpdbg_compile_file(zend_file_handle *file, int type) { phpdbg_file_source data, *dataptr; zend_file_handle fake = {{0}}; zend_op_array *ret; - char *filename = (char *)(file->opened_path ? file->opened_path->val : file->filename); + char *filename = (char *)(file->opened_path ? ZSTR_VAL(file->opened_path) : file->filename); uint line; char *bufptr, *endptr; char resolved_path_buf[MAXPATHLEN]; diff --git a/sapi/phpdbg/phpdbg_opcode.c b/sapi/phpdbg/phpdbg_opcode.c index 75009108a2..8adbbba36f 100644 --- a/sapi/phpdbg/phpdbg_opcode.c +++ b/sapi/phpdbg/phpdbg_opcode.c @@ -34,7 +34,7 @@ static inline char *phpdbg_decode_op(zend_op_array *ops, znode_op *op, uint32_t switch (type &~ EXT_TYPE_UNUSED) { case IS_CV: { zend_string *var = ops->vars[EX_VAR_TO_NUM(op->var)]; - asprintf(&decode, "$%.*s%c", var->len <= 19 ? (int) var->len : 18, var->val, var->len <= 19 ? 0 : '+'); + asprintf(&decode, "$%.*s%c", ZSTR_LEN(var) <= 19 ? (int) ZSTR_LEN(var) : 18, ZSTR_VAL(var), ZSTR_LEN(var) <= 19 ? 0 : '+'); } break; case IS_VAR: @@ -158,7 +158,7 @@ void phpdbg_print_opline_ex(zend_execute_data *execute_data, HashTable *vars, ze opline, phpdbg_decode_opcode(opline->opcode), decode, - execute_data->func->op_array.filename ? execute_data->func->op_array.filename->val : "unknown"); + execute_data->func->op_array.filename ? ZSTR_VAL(execute_data->func->op_array.filename) : "unknown"); } if (!ignore_flags && PHPDBG_G(oplog)) { @@ -167,7 +167,7 @@ void phpdbg_print_opline_ex(zend_execute_data *execute_data, HashTable *vars, ze opline, phpdbg_decode_opcode(opline->opcode), decode, - execute_data->func->op_array.filename ? execute_data->func->op_array.filename->val : "unknown"); + execute_data->func->op_array.filename ? ZSTR_VAL(execute_data->func->op_array.filename) : "unknown"); } if (decode) { diff --git a/sapi/phpdbg/phpdbg_out.c b/sapi/phpdbg/phpdbg_out.c index 3fa421ad33..cd9a4acaa0 100644 --- a/sapi/phpdbg/phpdbg_out.c +++ b/sapi/phpdbg/phpdbg_out.c @@ -1032,8 +1032,8 @@ static int phpdbg_process_print(int fd, int type, const char *tag, const char *m PHPDBG_G(in_script_xml) = type; } encoded = php_escape_html_entities((unsigned char *) msg, msglen, 0, ENT_NOQUOTES, PG(internal_encoding) && PG(internal_encoding)[0] ? PG(internal_encoding) : (SG(default_charset) ? SG(default_charset) : "UTF-8")); - buflen = encoded->len; - memcpy(buf = emalloc(buflen + 1), encoded->val, buflen); + buflen = ZSTR_LEN(encoded); + memcpy(buf = emalloc(buflen + 1), ZSTR_VAL(encoded), buflen); phpdbg_encode_ctrl_chars(&buf, &buflen); phpdbg_mixed_write(fd, buf, buflen); efree(buf); diff --git a/sapi/phpdbg/phpdbg_print.c b/sapi/phpdbg/phpdbg_print.c index 4013c0fd88..70b8c2f807 100644 --- a/sapi/phpdbg/phpdbg_print.c +++ b/sapi/phpdbg/phpdbg_print.c @@ -66,17 +66,17 @@ static inline void phpdbg_print_function_helper(zend_function *method) /* {{{ */ phpdbg_writeln("printoplineinfo", "type=\"User\" startline=\"%d\" endline=\"%d\" method=\"%s::%s\" file=\"%s\" opline=\"%p\"", "L%d-%d %s::%s() %s - %p + %d ops", op_array->line_start, op_array->line_end, - method->common.scope->name->val, - method->common.function_name->val, - op_array->filename ? op_array->filename->val : "unknown", + ZSTR_VAL(method->common.scope->name), + ZSTR_VAL(method->common.function_name), + op_array->filename ? ZSTR_VAL(op_array->filename) : "unknown", opline, op_array->last); } else { phpdbg_writeln("printoplineinfo", "type=\"User\" startline=\"%d\" endline=\"%d\" function=\"%s\" file=\"%s\" opline=\"%p\"", "L%d-%d %s() %s - %p + %d ops", op_array->line_start, op_array->line_end, - method->common.function_name ? method->common.function_name->val : "{main}", - op_array->filename ? op_array->filename->val : "unknown", + method->common.function_name ? ZSTR_VAL(method->common.function_name) : "{main}", + op_array->filename ? ZSTR_VAL(op_array->filename) : "unknown", opline, op_array->last); } @@ -102,9 +102,9 @@ static inline void phpdbg_print_function_helper(zend_function *method) /* {{{ */ default: { if (method->common.scope) { - phpdbg_writeln("printoplineinfo", "type=\"Internal\" method=\"%s::%s\"", "\tInternal %s::%s()", method->common.scope->name->val, method->common.function_name->val); + phpdbg_writeln("printoplineinfo", "type=\"Internal\" method=\"%s::%s\"", "\tInternal %s::%s()", ZSTR_VAL(method->common.scope->name), ZSTR_VAL(method->common.function_name)); } else { - phpdbg_writeln("printoplineinfo", "type=\"Internal\" function=\"%s\"", "\tInternal %s()", method->common.function_name->val); + phpdbg_writeln("printoplineinfo", "type=\"Internal\" function=\"%s\"", "\tInternal %s()", ZSTR_VAL(method->common.function_name)); } } } @@ -135,13 +135,13 @@ PHPDBG_PRINT(stack) /* {{{ */ zend_op_array *ops = &EG(current_execute_data)->func->op_array; if (ops->function_name) { if (ops->scope) { - phpdbg_notice("printinfo", "method=\"%s::%s\" num=\"%d\"", "Stack in %s::%s() (%d ops)", ops->scope->name->val, ops->function_name->val, ops->last); + phpdbg_notice("printinfo", "method=\"%s::%s\" num=\"%d\"", "Stack in %s::%s() (%d ops)", ZSTR_VAL(ops->scope->name), ZSTR_VAL(ops->function_name), ops->last); } else { - phpdbg_notice("printinfo", "function=\"%s\" num=\"%d\"", "Stack in %s() (%d ops)", ops->function_name->val, ops->last); + phpdbg_notice("printinfo", "function=\"%s\" num=\"%d\"", "Stack in %s() (%d ops)", ZSTR_VAL(ops->function_name), ops->last); } } else { if (ops->filename) { - phpdbg_notice("printinfo", "file=\"%s\" num=\"%d\"", "Stack in %s (%d ops)", ops->filename->val, ops->last); + phpdbg_notice("printinfo", "file=\"%s\" num=\"%d\"", "Stack in %s (%d ops)", ZSTR_VAL(ops->filename), ops->last); } else { phpdbg_notice("printinfo", "opline=\"%p\" num=\"%d\"", "Stack @ %p (%d ops)", ops, ops->last); } @@ -167,7 +167,7 @@ PHPDBG_PRINT(class) /* {{{ */ (ce->ce_flags & ZEND_ACC_ABSTRACT) ? "Abstract Class" : "Class", - ce->name->val, + ZSTR_VAL(ce->name), zend_hash_num_elements(&ce->function_table)); phpdbg_xml("<printmethods %r>"); @@ -195,12 +195,12 @@ PHPDBG_PRINT(method) /* {{{ */ if (phpdbg_safe_class_lookup(param->method.class, strlen(param->method.class), &ce) == SUCCESS) { zend_function *fbc; zend_string *lcname = zend_string_alloc(strlen(param->method.name), 0); - zend_str_tolower_copy(lcname->val, param->method.name, lcname->len); + zend_str_tolower_copy(ZSTR_VAL(lcname), param->method.name, ZSTR_LEN(lcname)); if ((fbc = zend_hash_find_ptr(&ce->function_table, lcname))) { phpdbg_notice("printinfo", "type=\"%s\" flags=\"Method\" symbol=\"%s\" num=\"%d\"", "%s Method %s (%d ops)", (fbc->type == ZEND_USER_FUNCTION) ? "User" : "Internal", - fbc->common.function_name->val, + ZSTR_VAL(fbc->common.function_name), (fbc->type == ZEND_USER_FUNCTION) ? fbc->op_array.last : 0); phpdbg_print_function_helper(fbc); @@ -242,14 +242,14 @@ PHPDBG_PRINT(func) /* {{{ */ } lcname = zend_string_alloc(func_name_len, 0); - zend_str_tolower_copy(lcname->val, func_name, lcname->len); + zend_str_tolower_copy(ZSTR_VAL(lcname), func_name, ZSTR_LEN(lcname)); phpdbg_try_access { if ((fbc = zend_hash_find_ptr(func_table, lcname))) { phpdbg_notice("printinfo", "type=\"%s\" flags=\"%s\" symbol=\"%s\" num=\"%d\"", "%s %s %s (%d ops)", (fbc->type == ZEND_USER_FUNCTION) ? "User" : "Internal", (fbc->common.scope) ? "Method" : "Function", - fbc->common.function_name->val, + ZSTR_VAL(fbc->common.function_name), (fbc->type == ZEND_USER_FUNCTION) ? fbc->op_array.last : 0); phpdbg_print_function_helper(fbc); @@ -320,7 +320,7 @@ void phpdbg_print_opcodes_class(const char *class) { (ce->ce_flags & ZEND_ACC_ABSTRACT) ? "abstract Class" : "class", - ce->name->val); + ZSTR_VAL(ce->name)); if (ce->type != ZEND_USER_CLASS) { return; @@ -333,7 +333,7 @@ void phpdbg_print_opcodes_class(const char *class) { } else { phpdbg_out(", "); } - phpdbg_out("%s", method->common.function_name->val); + phpdbg_out("%s", ZSTR_VAL(method->common.function_name)); } ZEND_HASH_FOREACH_END(); if (first) { phpdbg_out("-"); @@ -364,14 +364,14 @@ PHPDBG_API void phpdbg_print_opcodes(char *function) ZEND_HASH_FOREACH_STR_KEY_PTR(EG(function_table), name, func) { if (func->type == ZEND_USER_FUNCTION) { phpdbg_out("\n"); - phpdbg_print_opcodes_function(name->val, name->len); + phpdbg_print_opcodes_function(ZSTR_VAL(name), ZSTR_LEN(name)); } } ZEND_HASH_FOREACH_END(); ZEND_HASH_FOREACH_STR_KEY_PTR(EG(class_table), name, ce) { if (ce->type == ZEND_USER_CLASS) { phpdbg_out("\n\n"); - phpdbg_print_opcodes_class(name->val); + phpdbg_print_opcodes_class(ZSTR_VAL(name)); } } ZEND_HASH_FOREACH_END(); } else if ((method_name = strtok(NULL, ":")) == NULL) { diff --git a/sapi/phpdbg/phpdbg_prompt.c b/sapi/phpdbg/phpdbg_prompt.c index 71de3a2f7b..db44a2ef32 100644 --- a/sapi/phpdbg/phpdbg_prompt.c +++ b/sapi/phpdbg/phpdbg_prompt.c @@ -608,11 +608,11 @@ static inline void phpdbg_handle_exception(void) /* {{{ */ fci.params = NULL; fci.no_separation = 1; if (zend_call_function(&fci, NULL) == SUCCESS) { - phpdbg_writeln("exception", "name=\"%s\" trace=\"%.*s\"", "Uncaught %s!\n%.*s", ex->ce->name->val, Z_STRLEN(trace), Z_STRVAL(trace)); + phpdbg_writeln("exception", "name=\"%s\" trace=\"%.*s\"", "Uncaught %s!\n%.*s", ZSTR_VAL(ex->ce->name), Z_STRLEN(trace), Z_STRVAL(trace)); zval_ptr_dtor(&trace); } else { - phpdbg_error("exception", "name=\"%s\"", "Uncaught %s!", ex->ce->name->val); + phpdbg_error("exception", "name=\"%s\"", "Uncaught %s!", ZSTR_VAL(ex->ce->name)); } /* output useful information about address */ @@ -1467,7 +1467,7 @@ void phpdbg_execute_ex(zend_execute_data *execute_data) /* {{{ */ file = zval_get_string(zend_read_property(zend_get_exception_base(&zv), &zv, ZEND_STRL("file"), 1, &rv)); line = zval_get_long(zend_read_property(zend_get_exception_base(&zv), &zv, ZEND_STRL("line"), 1, &rv)); - phpdbg_error("exception", "name=\"%s\" file=\"%s\" line=\"%lld\"", "Uncaught exception %s in %s on line %lld", exception->ce->name->val, file->val, line); + phpdbg_error("exception", "name=\"%s\" file=\"%s\" line=\"%lld\"", "Uncaught exception %s in %s on line %lld", ZSTR_VAL(exception->ce->name), ZSTR_VAL(file), line); zend_string_release(file); DO_INTERACTIVE(1); } diff --git a/sapi/phpdbg/phpdbg_utils.c b/sapi/phpdbg/phpdbg_utils.c index 0d03c3cdd4..112f340d6b 100644 --- a/sapi/phpdbg/phpdbg_utils.c +++ b/sapi/phpdbg/phpdbg_utils.c @@ -167,12 +167,12 @@ PHPDBG_API const zend_function *phpdbg_get_function(const char *fname, const cha { zend_function *func = NULL; zend_string *lfname = zend_string_alloc(strlen(fname), 0); - memcpy(lfname->val, zend_str_tolower_dup(fname, lfname->len), lfname->len + 1); + memcpy(ZSTR_VAL(lfname), zend_str_tolower_dup(fname, ZSTR_LEN(lfname)), ZSTR_LEN(lfname) + 1); if (cname) { zend_class_entry *ce; zend_string *lcname = zend_string_alloc(strlen(cname), 0); - memcpy(lcname->val, zend_str_tolower_dup(cname, lcname->len), lcname->len + 1); + memcpy(ZSTR_VAL(lcname), zend_str_tolower_dup(cname, ZSTR_LEN(lcname)), ZSTR_LEN(lcname) + 1); ce = zend_lookup_class(lcname); efree(lcname); @@ -457,8 +457,8 @@ PHPDBG_API int phpdbg_parse_variable_with_arg(char *input, size_t len, HashTable char *name; char *keyname = estrndup(last_index, index_len); if (strkey) { - key = strkey->val; - keylen = strkey->len; + key = ZSTR_VAL(strkey); + keylen = ZSTR_LEN(strkey); } else { keylen = spprintf(&key, 0, "%llu", numkey); } @@ -573,7 +573,7 @@ static int phpdbg_xml_array_element_dump(zval *zv, zend_string *key, zend_ulong phpdbg_try_access { if (key) { /* string key */ - phpdbg_xml(" name=\"%.*s\"", key->len, key->val); + phpdbg_xml(" name=\"%.*s\"", ZSTR_LEN(key), ZSTR_VAL(key)); } else { /* numeric key */ phpdbg_xml(" name=\"%ld\"", num); } @@ -607,7 +607,7 @@ static int phpdbg_xml_object_property_dump(zval *zv, zend_string *key, zend_ulon phpdbg_xml(" class=\"%s\" protection=\"private\"", class_name); } } else { - phpdbg_xml(" name=\"%.*s\" protection=\"public\"", key->len, key->val); + phpdbg_xml(" name=\"%.*s\" protection=\"public\"", ZSTR_LEN(key), ZSTR_VAL(key)); } } else { /* numeric key */ phpdbg_xml(" name=\"%ld\" protection=\"public\"", num); @@ -681,7 +681,7 @@ PHPDBG_API void phpdbg_xml_var_dump(zval *zv) { } class_name = Z_OBJ_HANDLER_P(zv, get_class_name)(Z_OBJ_P(zv)); - phpdbg_xml("<object refstatus=\"%s\" class=\"%.*s\" id=\"%d\" num=\"%d\">", COMMON, class_name->len, class_name->val, Z_OBJ_HANDLE_P(zv), myht ? zend_hash_num_elements(myht) : 0); + phpdbg_xml("<object refstatus=\"%s\" class=\"%.*s\" id=\"%d\" num=\"%d\">", COMMON, ZSTR_LEN(class_name), ZSTR_VAL(class_name), Z_OBJ_HANDLE_P(zv), myht ? zend_hash_num_elements(myht) : 0); zend_string_release(class_name); element_dump_func = phpdbg_xml_object_property_dump; @@ -784,12 +784,12 @@ char *phpdbg_short_zval_print(zval *zv, int maxlen) /* {{{ */ case IS_STRING: { int i; zend_string *str = php_addcslashes(Z_STR_P(zv), 0, "\\\"", 2); - for (i = 0; i < str->len; i++) { - if (str->val[i] < 32) { - str->val[i] = ' '; + for (i = 0; i < ZSTR_LEN(str); i++) { + if (ZSTR_VAL(str)[i] < 32) { + ZSTR_VAL(str)[i] = ' '; } } - asprintf(&decode, "\"%.*s\"%c", str->len <= maxlen - 2 ? (int) str->len : (maxlen - 3), str->val, str->len <= maxlen - 2 ? 0 : '+'); + asprintf(&decode, "\"%.*s\"%c", ZSTR_LEN(str) <= maxlen - 2 ? (int) ZSTR_LEN(str) : (maxlen - 3), ZSTR_VAL(str), ZSTR_LEN(str) <= maxlen - 2 ? 0 : '+'); zend_string_release(str); } break; case IS_RESOURCE: @@ -800,7 +800,7 @@ char *phpdbg_short_zval_print(zval *zv, int maxlen) /* {{{ */ break; case IS_OBJECT: { zend_string *str = Z_OBJCE_P(zv)->name; - asprintf(&decode, "%.*s%c", str->len <= maxlen ? (int) str->len : maxlen - 1, str->val, str->len <= maxlen ? 0 : '+'); + asprintf(&decode, "%.*s%c", ZSTR_LEN(str) <= maxlen ? (int) ZSTR_LEN(str) : maxlen - 1, ZSTR_VAL(str), ZSTR_LEN(str) <= maxlen ? 0 : '+'); break; } case IS_CONSTANT: diff --git a/sapi/phpdbg/phpdbg_wait.c b/sapi/phpdbg/phpdbg_wait.c index d633778de1..856f6e2b3e 100644 --- a/sapi/phpdbg/phpdbg_wait.c +++ b/sapi/phpdbg/phpdbg_wait.c @@ -36,7 +36,7 @@ static void phpdbg_rebuild_http_globals_array(int type, const char *name) { static int phpdbg_dearm_autoglobals(zend_auto_global *auto_global) { - if (auto_global->name->len != sizeof("GLOBALS") - 1 || memcmp(auto_global->name->val, "GLOBALS", sizeof("GLOBALS") - 1)) { + if (ZSTR_LEN(auto_global->name) != sizeof("GLOBALS") - 1 || memcmp(ZSTR_VAL(auto_global->name), "GLOBALS", sizeof("GLOBALS") - 1)) { auto_global->armed = 0; } diff --git a/sapi/phpdbg/phpdbg_watch.c b/sapi/phpdbg/phpdbg_watch.c index 49f8885b90..7452771cf2 100644 --- a/sapi/phpdbg/phpdbg_watch.c +++ b/sapi/phpdbg/phpdbg_watch.c @@ -463,7 +463,7 @@ static int phpdbg_create_recursive_ht_watch(phpdbg_watchpoint_t *watch) { efree(str); } - str_len = spprintf(&str, 0, "%.*s%s%s%s", (int) watch->str->len - 2, watch->str->val, (watch->flags & PHPDBG_WATCH_ARRAY) ? "[" : "->", phpdbg_get_property_key(new_watch->name_in_parent->val), (watch->flags & PHPDBG_WATCH_ARRAY) ? "]" : ""); + str_len = spprintf(&str, 0, "%.*s%s%s%s", (int) ZSTR_LEN(watch->str) - 2, ZSTR_VAL(watch->str), (watch->flags & PHPDBG_WATCH_ARRAY) ? "[" : "->", phpdbg_get_property_key(ZSTR_VAL(new_watch->name_in_parent)), (watch->flags & PHPDBG_WATCH_ARRAY) ? "]" : ""); new_watch->str = zend_string_init(str, str_len, 0); efree(str); @@ -498,7 +498,7 @@ static int phpdbg_create_recursive_zval_watch(phpdbg_watchpoint_t *watch) { new_watch->parent_container = watch->parent_container; new_watch->name_in_parent = watch->name_in_parent; ++GC_REFCOUNT(new_watch->name_in_parent); - str_len = spprintf(&str, 0, "%.*s[]", (int) watch->str->len, watch->str->val); + str_len = spprintf(&str, 0, "%.*s[]", (int) ZSTR_LEN(watch->str), ZSTR_VAL(watch->str)); new_watch->str = zend_string_init(str, str_len, 0); efree(str); @@ -572,9 +572,9 @@ static void phpdbg_delete_ht_watchpoints_recursive(phpdbg_watchpoint_t *watch) { ZEND_HASH_FOREACH_KEY(HT_WATCH_HT(watch), numkey, strkey) { if (strkey) { - str_len = spprintf(&str, 0, "%.*s%s%s%s", (int) watch->str->len, watch->str->val, (watch->flags & PHPDBG_WATCH_ARRAY) ? "[" : "->", phpdbg_get_property_key(strkey->val), (watch->flags & PHPDBG_WATCH_ARRAY) ? "]" : ""); + str_len = spprintf(&str, 0, "%.*s%s%s%s", (int) ZSTR_LEN(watch->str), ZSTR_VAL(watch->str), (watch->flags & PHPDBG_WATCH_ARRAY) ? "[" : "->", phpdbg_get_property_key(ZSTR_VAL(strkey)), (watch->flags & PHPDBG_WATCH_ARRAY) ? "]" : ""); } else { - str_len = spprintf(&str, 0, "%.*s%s" ZEND_LONG_FMT "%s", (int) watch->str->len, watch->str->val, (watch->flags & PHPDBG_WATCH_ARRAY) ? "[" : "->", numkey, (watch->flags & PHPDBG_WATCH_ARRAY) ? "]" : ""); + str_len = spprintf(&str, 0, "%.*s%s" ZEND_LONG_FMT "%s", (int) ZSTR_LEN(watch->str), ZSTR_VAL(watch->str), (watch->flags & PHPDBG_WATCH_ARRAY) ? "[" : "->", numkey, (watch->flags & PHPDBG_WATCH_ARRAY) ? "]" : ""); } if ((watchpoint = zend_hash_str_find_ptr(&PHPDBG_G(watchpoints), str, str_len))) { @@ -761,7 +761,7 @@ void phpdbg_watch_HashTable_dtor(zval *zv) { if (watch->flags & PHPDBG_WATCH_NORMAL) { PHPDBG_G(watchpoint_hit) = 1; - phpdbg_notice("watchdelete", "variable=\"%.*s\" recursive=\"%s\"", "%.*s was removed, removing watchpoint%s", (int) watch->str->len, watch->str->val, (watch->flags & PHPDBG_WATCH_RECURSIVE) ? " recursively" : ""); + phpdbg_notice("watchdelete", "variable=\"%.*s\" recursive=\"%s\"", "%.*s was removed, removing watchpoint%s", (int) ZSTR_LEN(watch->str), ZSTR_VAL(watch->str), (watch->flags & PHPDBG_WATCH_RECURSIVE) ? " recursively" : ""); } if (watch->flags & PHPDBG_WATCH_RECURSIVE) { @@ -979,7 +979,7 @@ static void phpdbg_print_changed_zval(phpdbg_watch_memdump *dump) { if (do_break) { PHPDBG_G(watchpoint_hit) = 1; - phpdbg_notice("watchhit", "variable=\"%s\"", "Breaking on watchpoint %.*s", (int) watch->str->len, watch->str->val); + phpdbg_notice("watchhit", "variable=\"%s\"", "Breaking on watchpoint %.*s", (int) ZSTR_LEN(watch->str), ZSTR_VAL(watch->str)); phpdbg_xml("<watchdata %r>"); } @@ -1003,7 +1003,7 @@ static void phpdbg_print_changed_zval(phpdbg_watch_memdump *dump) { /* check if zval was removed */ if (removed) { if (watch->flags & PHPDBG_WATCH_NORMAL) { - phpdbg_notice("watchdelete", "variable=\"%.*s\"", "Watchpoint %.*s was unset, removing watchpoint", (int) watch->str->len, watch->str->val); + phpdbg_notice("watchdelete", "variable=\"%.*s\"", "Watchpoint %.*s was unset, removing watchpoint", (int) ZSTR_LEN(watch->str), ZSTR_VAL(watch->str)); } zend_hash_del(&PHPDBG_G(watchpoints), watch->str); @@ -1111,7 +1111,7 @@ void phpdbg_list_watchpoints(void) { ZEND_HASH_FOREACH_PTR(&PHPDBG_G(watchpoints), watch) { if (watch->flags & PHPDBG_WATCH_NORMAL) { - phpdbg_writeln("watchvariable", "variable=\"%.*s\" on=\"%s\" type=\"%s\"", "%.*s (%s, %s)", (int) watch->str->len, watch->str->val, watch->type == WATCH_ON_HASHTABLE ? "array" : watch->type == WATCH_ON_REFCOUNTED ? "refcount" : "variable", watch->flags == PHPDBG_WATCH_RECURSIVE ? "recursive" : "simple"); + phpdbg_writeln("watchvariable", "variable=\"%.*s\" on=\"%s\" type=\"%s\"", "%.*s (%s, %s)", (int) ZSTR_LEN(watch->str), ZSTR_VAL(watch->str), watch->type == WATCH_ON_HASHTABLE ? "array" : watch->type == WATCH_ON_REFCOUNTED ? "refcount" : "variable", watch->flags == PHPDBG_WATCH_RECURSIVE ? "recursive" : "simple"); } } ZEND_HASH_FOREACH_END(); @@ -1137,7 +1137,7 @@ void phpdbg_watch_efree(void *ptr) { } if (watch->type == WATCH_ON_HASHTABLE && (watch->flags & PHPDBG_WATCH_SIMPLE)) { /* when a HashTable is freed, we can safely assume the other zvals all were dtor'ed */ - phpdbg_notice("watchdelete", "variable=\"%.*s\" recursive=\"%s\"", "Array %.*s was removed, removing watchpoint%s", (int) watch->str->len, watch->str->val, (watch->flags & PHPDBG_WATCH_RECURSIVE) ? " recursively" : ""); + phpdbg_notice("watchdelete", "variable=\"%.*s\" recursive=\"%s\"", "Array %.*s was removed, removing watchpoint%s", (int) ZSTR_LEN(watch->str), ZSTR_VAL(watch->str), (watch->flags & PHPDBG_WATCH_RECURSIVE) ? " recursively" : ""); } if (watch->type == WATCH_ON_HASHTABLE || watch->parent == NULL || watch->parent->type != WATCH_ON_ZVAL) { /* no references */ zend_hash_del(&PHPDBG_G(watchpoints), watch->str); diff --git a/sapi/phpdbg/phpdbg_webdata_transfer.c b/sapi/phpdbg/phpdbg_webdata_transfer.c index af5847c7f4..ddcf2deec2 100644 --- a/sapi/phpdbg/phpdbg_webdata_transfer.c +++ b/sapi/phpdbg/phpdbg_webdata_transfer.c @@ -167,8 +167,8 @@ PHPDBG_API void phpdbg_webdata_compress(char **msg, int *len) { PHP_VAR_SERIALIZE_INIT(var_hash); php_var_serialize(&buf, &array, &var_hash); PHP_VAR_SERIALIZE_DESTROY(var_hash); - *msg = buf.s->val; - *len = buf.s->len; + *msg = ZSTR_VAL(buf.s); + *len = ZSTR_LEN(buf.s); } zval_dtor(&array); |
