From 996fabb0dbde621c749722040a8f64bf421a84f1 Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Tue, 10 Mar 2026 14:21:31 +0000 Subject: [PATCH] use smart_str_append() if we have a zend_string* --- Zend/zend.c | 1 + Zend/zend_ast.c | 6 ++--- Zend/zend_exceptions.c | 16 +++++++++--- Zend/zend_inheritance.c | 2 +- ext/iconv/iconv.c | 2 +- ext/intl/locale/locale_methods.cpp | 8 +++--- ext/mbstring/php_mbregex.c | 2 +- ext/opcache/jit/zend_jit.c | 8 +++--- ext/opcache/jit/zend_jit_trace.c | 8 +++--- ext/phar/phar.c | 2 +- ext/reflection/php_reflection.c | 2 +- ext/soap/php_http.c | 42 +++++++++++++++--------------- ext/soap/php_sdl.c | 4 +-- ext/soap/soap.c | 22 ++++++++-------- ext/standard/http_fopen_wrapper.c | 10 +++---- ext/standard/url_scanner_ex.re | 34 ++++++++++++------------ 16 files changed, 90 insertions(+), 79 deletions(-) diff --git a/Zend/zend.c b/Zend/zend.c index bce1faede8fb9..af0013220f20d 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -565,6 +565,7 @@ static void zend_print_zval_r_to_buf(smart_str *buf, zval *expr, int indent) /* zend_object *zobj = Z_OBJ_P(expr); uint32_t *guard = zend_get_recursion_guard(zobj); zend_string *class_name = Z_OBJ_HANDLER_P(expr, get_class_name)(zobj); + /* cut off on NULL byte ... class@anonymous */ smart_str_appends(buf, ZSTR_VAL(class_name)); zend_string_release_ex(class_name, 0); diff --git a/Zend/zend_ast.c b/Zend/zend_ast.c index 9d93c4d222518..e6270262e4524 100644 --- a/Zend/zend_ast.c +++ b/Zend/zend_ast.c @@ -2160,7 +2160,7 @@ static ZEND_COLD void zend_ast_export_ex(smart_str *str, zend_ast *ast, int prio break; case ZEND_AST_CONSTANT: { zend_string *name = zend_ast_get_constant_name(ast); - smart_str_appendl(str, ZSTR_VAL(name), ZSTR_LEN(name)); + smart_str_append(str, name); break; } case ZEND_AST_OP_ARRAY: @@ -2210,7 +2210,7 @@ static ZEND_COLD void zend_ast_export_ex(smart_str *str, zend_ast *ast, int prio smart_str_appendc(str, '&'); } if (ast->kind != ZEND_AST_CLOSURE && ast->kind != ZEND_AST_ARROW_FUNC) { - smart_str_appendl(str, ZSTR_VAL(decl->name), ZSTR_LEN(decl->name)); + smart_str_append(str, decl->name); } smart_str_appendc(str, '('); zend_ast_export_ex(str, decl->child[0], 0, indent); @@ -2268,7 +2268,7 @@ static ZEND_COLD void zend_ast_export_ex(smart_str *str, zend_ast *ast, int prio } smart_str_appends(str, "class "); } - smart_str_appendl(str, ZSTR_VAL(decl->name), ZSTR_LEN(decl->name)); + smart_str_append(str, decl->name); if (decl->flags & ZEND_ACC_ENUM && decl->child[4]) { smart_str_appends(str, ": "); zend_ast_export_type(str, decl->child[4], indent); diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index 52e3ab0092540..bc794fa3b902c 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -497,12 +497,12 @@ ZEND_METHOD(ErrorException, getSeverity) #define TRACE_APPEND_KEY(key) do { \ tmp = zend_hash_find(ht, key); \ if (tmp) { \ - if (Z_TYPE_P(tmp) != IS_STRING) { \ + if (UNEXPECTED(Z_TYPE_P(tmp) != IS_STRING)) { \ zend_error(E_WARNING, "Value for %s is not a string", \ ZSTR_VAL(key)); \ smart_str_appends(str, "[unknown]"); \ } else { \ - smart_str_appends(str, Z_STRVAL_P(tmp)); \ + smart_str_append(str, Z_STR_P(tmp)); \ } \ } \ } while (0) @@ -532,6 +532,7 @@ static void _build_trace_args(zval *arg, smart_str *str) /* {{{ */ case IS_OBJECT: { zend_string *class_name = Z_OBJ_HANDLER_P(arg, get_class_name)(Z_OBJ_P(arg)); smart_str_appends(str, "Object("); + /* cut off on NULL byte ... class@anonymous */ smart_str_appends(str, ZSTR_VAL(class_name)); smart_str_appends(str, "), "); zend_string_release_ex(class_name, 0); @@ -573,7 +574,16 @@ static void _build_trace_string(smart_str *str, const HashTable *ht, uint32_t nu } else { smart_str_appends(str, "[internal function]: "); } - TRACE_APPEND_KEY(ZSTR_KNOWN(ZEND_STR_CLASS)); + const zval *class_name = zend_hash_find(ht, ZSTR_KNOWN(ZEND_STR_CLASS)); + if (class_name) { + if (UNEXPECTED(Z_TYPE_P(class_name) != IS_STRING)) { + zend_error(E_WARNING, "Value for class is not a string"); + smart_str_appends(str, "[unknown]"); + } else { + /* cut off on NULL byte ... class@anonymous */ + smart_str_appends(str, Z_STRVAL_P(class_name)); + } + } TRACE_APPEND_KEY(ZSTR_KNOWN(ZEND_STR_TYPE)); TRACE_APPEND_KEY(ZSTR_KNOWN(ZEND_STR_FUNCTION)); smart_str_appendc(str, '('); diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c index ba13a3233ed2a..bfa709ba60b6f 100644 --- a/Zend/zend_inheritance.c +++ b/Zend/zend_inheritance.c @@ -924,7 +924,7 @@ static ZEND_COLD zend_string *zend_get_function_declaration( /* cut off on NULL byte ... class@anonymous */ smart_str_appends(&str, ZSTR_VAL(fptr->common.scope->name)); } else { - smart_str_appendl(&str, ZSTR_VAL(fptr->common.scope->name), ZSTR_LEN(fptr->common.scope->name)); + smart_str_append(&str, fptr->common.scope->name); } smart_str_appends(&str, "::"); } diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c index 7c812f5af44b4..13dc7074b9b32 100644 --- a/ext/iconv/iconv.c +++ b/ext/iconv/iconv.c @@ -1073,7 +1073,7 @@ static php_iconv_err_t _php_iconv_mime_encode(smart_str *pretval, const char *fn goto out; } - smart_str_appendl(pretval, ZSTR_VAL(encoded), ZSTR_LEN(encoded)); + smart_str_append(pretval, encoded); char_cnt -= ZSTR_LEN(encoded); smart_str_appendl(pretval, "?=", sizeof("?=") - 1); char_cnt -= 2; diff --git a/ext/intl/locale/locale_methods.cpp b/ext/intl/locale/locale_methods.cpp index 5cf6928a8cd3c..8f09e5c116e11 100644 --- a/ext/intl/locale/locale_methods.cpp +++ b/ext/intl/locale/locale_methods.cpp @@ -815,7 +815,7 @@ static int append_key_value(smart_str* loc_name, HashTable* hash_arr, const char /* not lang or grandfathered tag */ smart_str_appendl(loc_name, SEPARATOR , sizeof(SEPARATOR)-1); } - smart_str_appendl(loc_name, Z_STRVAL_P(ele_value) , Z_STRLEN_P(ele_value)); + smart_str_append(loc_name, Z_STR_P(ele_value)); return SUCCESS; } @@ -853,7 +853,7 @@ static int append_multiple_key_values(smart_str* loc_name, HashTable* hash_arr, add_prefix( loc_name , key_name); smart_str_appendl(loc_name, SEPARATOR , sizeof(SEPARATOR)-1); - smart_str_appendl(loc_name, Z_STRVAL_P(ele_value) , Z_STRLEN_P(ele_value)); + smart_str_append(loc_name, Z_STR_P(ele_value)); return SUCCESS; } else if(Z_TYPE_P(ele_value) == IS_ARRAY ) { HashTable *arr = Z_ARRVAL_P(ele_value); @@ -868,7 +868,7 @@ static int append_multiple_key_values(smart_str* loc_name, HashTable* hash_arr, add_prefix(loc_name , key_name); } smart_str_appendl(loc_name, SEPARATOR , sizeof(SEPARATOR)-1); - smart_str_appendl(loc_name, Z_STRVAL_P(data) , Z_STRLEN_P(data)); + smart_str_append(loc_name, Z_STR_P(data)); } ZEND_HASH_FOREACH_END(); return SUCCESS; } else { @@ -902,7 +902,7 @@ static int append_multiple_key_values(smart_str* loc_name, HashTable* hash_arr, add_prefix(loc_name , cur_key_name); } smart_str_appendl(loc_name, SEPARATOR , sizeof(SEPARATOR)-1); - smart_str_appendl(loc_name, Z_STRVAL_P(ele_value) , Z_STRLEN_P(ele_value)); + smart_str_append(loc_name, Z_STR_P(ele_value)); } } /* end of for */ } /* end of else */ diff --git a/ext/mbstring/php_mbregex.c b/ext/mbstring/php_mbregex.c index a819def4b5bd5..a830d978db75b 100644 --- a/ext/mbstring/php_mbregex.c +++ b/ext/mbstring/php_mbregex.c @@ -1103,7 +1103,7 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp if (zend_call_function(&arg_replace_fci, &arg_replace_fci_cache) == SUCCESS && !Z_ISUNDEF(retval)) { convert_to_string(&retval); - smart_str_appendl(&out_buf, Z_STRVAL(retval), Z_STRLEN(retval)); + smart_str_append(&out_buf, Z_STR(retval)); smart_str_free(&eval_buf); zval_ptr_dtor(&retval); } diff --git a/ext/opcache/jit/zend_jit.c b/ext/opcache/jit/zend_jit.c index 3ffb669e84742..81bbaec04cdea 100644 --- a/ext/opcache/jit/zend_jit.c +++ b/ext/opcache/jit/zend_jit.c @@ -880,13 +880,13 @@ static zend_string *zend_jit_func_name(const zend_op_array *op_array) if (op_array->function_name) { smart_str_appends(&buf, JIT_PREFIX); if (op_array->scope) { - smart_str_appendl(&buf, ZSTR_VAL(op_array->scope->name), ZSTR_LEN(op_array->scope->name)); + smart_str_append(&buf, op_array->scope->name); smart_str_appends(&buf, "::"); } - smart_str_appendl(&buf, ZSTR_VAL(op_array->function_name), ZSTR_LEN(op_array->function_name)); + smart_str_append(&buf, op_array->function_name); if (op_array->fn_flags & ZEND_ACC_CLOSURE) { smart_str_appends(&buf, ":"); - smart_str_appendl(&buf, ZSTR_VAL(op_array->filename), ZSTR_LEN(op_array->filename)); + smart_str_append(&buf, op_array->filename); smart_str_appends(&buf, ":"); smart_str_append_long(&buf, op_array->line_start); } @@ -894,7 +894,7 @@ static zend_string *zend_jit_func_name(const zend_op_array *op_array) return buf.s; } else if (op_array->filename) { smart_str_appends(&buf, JIT_PREFIX); - smart_str_appendl(&buf, ZSTR_VAL(op_array->filename), ZSTR_LEN(op_array->filename)); + smart_str_append(&buf, op_array->filename); smart_str_0(&buf); return buf.s; } else { diff --git a/ext/opcache/jit/zend_jit_trace.c b/ext/opcache/jit/zend_jit_trace.c index 82e173ba49947..56fa57db1615b 100644 --- a/ext/opcache/jit/zend_jit_trace.c +++ b/ext/opcache/jit/zend_jit_trace.c @@ -258,14 +258,14 @@ static zend_string *zend_jit_trace_name(const zend_op_array *op_array, uint32_t smart_str_appendc(&buf, '$'); if (op_array->function_name) { if (op_array->scope) { - smart_str_appendl(&buf, ZSTR_VAL(op_array->scope->name), ZSTR_LEN(op_array->scope->name)); + smart_str_append(&buf, op_array->scope->name); smart_str_appends(&buf, "::"); - smart_str_appendl(&buf, ZSTR_VAL(op_array->function_name), ZSTR_LEN(op_array->function_name)); + smart_str_append(&buf, op_array->function_name); } else { - smart_str_appendl(&buf, ZSTR_VAL(op_array->function_name), ZSTR_LEN(op_array->function_name)); + smart_str_append(&buf, op_array->function_name); } } else if (op_array->filename) { - smart_str_appendl(&buf, ZSTR_VAL(op_array->filename), ZSTR_LEN(op_array->filename)); + smart_str_append(&buf, op_array->filename); } smart_str_appendc(&buf, '$'); smart_str_append_long(&buf, (zend_long)lineno); diff --git a/ext/phar/phar.c b/ext/phar/phar.c index 619017038637c..bb08af18ff840 100644 --- a/ext/phar/phar.c +++ b/ext/phar/phar.c @@ -2606,7 +2606,7 @@ ZEND_ATTRIBUTE_NONNULL_ARGS(1, 4) int phar_flush_ex(phar_archive_data *phar, zen /* compress as necessary, calculate crcs, serialize meta-data, manifest size, and file sizes */ main_metadata_str.s = NULL; if (phar->metadata_tracker.str) { - smart_str_appendl(&main_metadata_str, ZSTR_VAL(phar->metadata_tracker.str), ZSTR_LEN(phar->metadata_tracker.str)); + smart_str_append(&main_metadata_str, phar->metadata_tracker.str); } else if (!Z_ISUNDEF(phar->metadata_tracker.val)) { PHP_VAR_SERIALIZE_INIT(metadata_hash); php_var_serialize(&main_metadata_str, &phar->metadata_tracker.val, &metadata_hash); diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index e44a746ff0846..85216d8bd25ee 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -612,7 +612,7 @@ static void _const_string(smart_str *str, const char *name, zval *value, const c if (Z_TYPE_P(value) == IS_ARRAY) { smart_str_append(str, ZSTR_KNOWN(ZEND_STR_ARRAY_CAPITALIZED)); } else if (Z_TYPE_P(value) == IS_STRING) { - smart_str_appends(str, Z_STRVAL_P(value)); + smart_str_append(str, Z_STR_P(value)); } else { zend_string *tmp_value_str; zend_string *value_str = zval_get_tmp_string(value, &tmp_value_str); diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c index 4bf599234f780..813d81640cb21 100644 --- a/ext/soap/php_http.c +++ b/ext/soap/php_http.c @@ -254,12 +254,12 @@ static php_stream* http_connect(zval* this_ptr, php_uri *uri, int use_ssl, php_s } smart_str_append_const(&soap_headers, "CONNECT "); - smart_str_appends(&soap_headers, ZSTR_VAL(uri->host)); + smart_str_append(&soap_headers, uri->host); smart_str_appendc(&soap_headers, ':'); smart_str_append_unsigned(&soap_headers, uri->port); smart_str_append_const(&soap_headers, " HTTP/1.1\r\n"); smart_str_append_const(&soap_headers, "Host: "); - smart_str_appends(&soap_headers, ZSTR_VAL(uri->host)); + smart_str_append(&soap_headers, uri->host); if (uri->port != 80) { smart_str_appendc(&soap_headers, ':'); smart_str_append_unsigned(&soap_headers, uri->port); @@ -574,24 +574,24 @@ int make_http_soap_request( smart_str_append_const(&soap_headers, "POST "); if (use_proxy && !use_ssl) { - smart_str_appends(&soap_headers, ZSTR_VAL(uri->scheme)); + smart_str_append(&soap_headers, uri->scheme); smart_str_append_const(&soap_headers, "://"); - smart_str_appends(&soap_headers, ZSTR_VAL(uri->host)); + smart_str_append(&soap_headers, uri->host); smart_str_appendc(&soap_headers, ':'); smart_str_append_unsigned(&soap_headers, uri->port); } if (uri->path) { - smart_str_appends(&soap_headers, ZSTR_VAL(uri->path)); + smart_str_append(&soap_headers, uri->path); } else { smart_str_appendc(&soap_headers, '/'); } if (uri->query) { smart_str_appendc(&soap_headers, '?'); - smart_str_appends(&soap_headers, ZSTR_VAL(uri->query)); + smart_str_append(&soap_headers, uri->query); } if (uri->fragment) { smart_str_appendc(&soap_headers, '#'); - smart_str_appends(&soap_headers, ZSTR_VAL(uri->fragment)); + smart_str_append(&soap_headers, uri->fragment); } if (http_1_1) { smart_str_append_const(&soap_headers, " HTTP/1.1\r\n"); @@ -599,7 +599,7 @@ int make_http_soap_request( smart_str_append_const(&soap_headers, " HTTP/1.0\r\n"); } smart_str_append_const(&soap_headers, "Host: "); - smart_str_appends(&soap_headers, ZSTR_VAL(uri->host)); + smart_str_append(&soap_headers, uri->host); if (uri->port != (use_ssl?443:80)) { smart_str_appendc(&soap_headers, ':'); smart_str_append_unsigned(&soap_headers, uri->port); @@ -615,7 +615,7 @@ int make_http_soap_request( if (Z_TYPE_P(tmp) == IS_STRING) { if (Z_STRLEN_P(tmp) > 0) { smart_str_append_const(&soap_headers, "User-Agent: "); - smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); + smart_str_append(&soap_headers, Z_STR_P(tmp)); smart_str_append_const(&soap_headers, "\r\n"); } } else if (context && @@ -623,7 +623,7 @@ int make_http_soap_request( Z_TYPE_P(tmp) == IS_STRING) { if (Z_STRLEN_P(tmp) > 0) { smart_str_append_const(&soap_headers, "User-Agent: "); - smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); + smart_str_append(&soap_headers, Z_STR_P(tmp)); smart_str_append_const(&soap_headers, "\r\n"); } } else if (FG(user_agent)) { @@ -643,7 +643,7 @@ int make_http_soap_request( Z_STRLEN_P(tmp) > 0 ) { smart_str_append_const(&soap_headers, "Content-Type: "); - smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); + smart_str_append(&soap_headers, Z_STR_P(tmp)); } else { smart_str_append_const(&soap_headers, "Content-Type: application/soap+xml; charset=utf-8"); } @@ -660,7 +660,7 @@ int make_http_soap_request( Z_STRLEN_P(tmp) > 0 ) { smart_str_append_const(&soap_headers, "Content-Type: "); - smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); + smart_str_append(&soap_headers, Z_STR_P(tmp)); smart_str_append_const(&soap_headers, "\r\n"); } else { smart_str_append_const(&soap_headers, "Content-Type: text/xml; charset=utf-8\r\n"); @@ -780,30 +780,30 @@ int make_http_soap_request( make_digest(response, hash); smart_str_append_const(&soap_headers, "Authorization: Digest username=\""); - smart_str_appendl(&soap_headers, Z_STRVAL_P(login), Z_STRLEN_P(login)); + smart_str_append(&soap_headers, Z_STR_P(login)); if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "realm", sizeof("realm")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { smart_str_append_const(&soap_headers, "\", realm=\""); - smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); + smart_str_append(&soap_headers, Z_STR_P(tmp)); } if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "nonce", sizeof("nonce")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { smart_str_append_const(&soap_headers, "\", nonce=\""); - smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); + smart_str_append(&soap_headers, Z_STR_P(tmp)); } smart_str_append_const(&soap_headers, "\", uri=\""); if (uri->path) { - smart_str_appends(&soap_headers, ZSTR_VAL(uri->path)); + smart_str_append(&soap_headers, uri->path); } else { smart_str_appendc(&soap_headers, '/'); } if (uri->query) { smart_str_appendc(&soap_headers, '?'); - smart_str_appends(&soap_headers, ZSTR_VAL(uri->query)); + smart_str_append(&soap_headers, uri->query); } if (uri->fragment) { smart_str_appendc(&soap_headers, '#'); - smart_str_appends(&soap_headers, ZSTR_VAL(uri->fragment)); + smart_str_append(&soap_headers, uri->fragment); } if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "qop", sizeof("qop")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { @@ -819,12 +819,12 @@ int make_http_soap_request( if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "opaque", sizeof("opaque")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { smart_str_append_const(&soap_headers, "\", opaque=\""); - smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); + smart_str_append(&soap_headers, Z_STR_P(tmp)); } if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "algorithm", sizeof("algorithm")-1)) != NULL && Z_TYPE_P(tmp) == IS_STRING) { smart_str_append_const(&soap_headers, "\", algorithm=\""); - smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); + smart_str_append(&soap_headers, Z_STR_P(tmp)); } smart_str_append_const(&soap_headers, "\"\r\n"); } else { @@ -899,7 +899,7 @@ int make_http_soap_request( ZVAL_STRINGL(Z_CLIENT_LAST_REQUEST_HEADERS_P(this_ptr), ZSTR_VAL(soap_headers.s), ZSTR_LEN(soap_headers.s)); } - smart_str_appendl(&soap_headers, request->val, request->len); + smart_str_append(&soap_headers, request); smart_str_0(&soap_headers); err = php_stream_write(stream, ZSTR_VAL(soap_headers.s), ZSTR_LEN(soap_headers.s)); diff --git a/ext/soap/php_sdl.c b/ext/soap/php_sdl.c index e6871cd6e9b31..927d7130d37f0 100644 --- a/ext/soap/php_sdl.c +++ b/ext/soap/php_sdl.c @@ -3243,7 +3243,7 @@ sdlPtr get_sdl(zval *this_ptr, char *uri, zend_long cache_wsdl) tmp = Z_CLIENT_USER_AGENT_P(this_ptr); if (Z_TYPE_P(tmp) == IS_STRING && Z_STRLEN_P(tmp) > 0) { smart_str_appends(&headers, "User-Agent: "); - smart_str_appends(&headers, Z_STRVAL_P(tmp)); + smart_str_append(&headers, Z_STR_P(tmp)); smart_str_appends(&headers, "\r\n"); } @@ -3253,7 +3253,7 @@ sdlPtr get_sdl(zval *this_ptr, char *uri, zend_long cache_wsdl) zval str_proxy; smart_str proxy = {0}; smart_str_appends(&proxy,"tcp://"); - smart_str_appends(&proxy,Z_STRVAL_P(proxy_host)); + smart_str_append(&proxy, Z_STR_P(proxy_host)); smart_str_appends(&proxy,":"); smart_str_append_long(&proxy,Z_LVAL_P(proxy_port)); ZVAL_STR(&str_proxy, smart_str_extract(&proxy)); diff --git a/ext/soap/soap.c b/ext/soap/soap.c index 6c850a27cf0f7..a603ee4458bef 100644 --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@ -3390,7 +3390,7 @@ static sdlFunctionPtr deserialize_function_call(sdlPtr sdl, xmlDocPtr request, c smart_str_appends(&key, (char*)hdr_func->ns->href); smart_str_appendc(&key, ':'); } - smart_str_appendl(&key, Z_STRVAL(h->function_name), Z_STRLEN(h->function_name)); + smart_str_append(&key, Z_STR(h->function_name)); smart_str_0(&key); if ((hdr = zend_hash_find_ptr(fnb->input.headers, key.s)) != NULL) { h->hdr = hdr; @@ -3627,14 +3627,14 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, const char *fu tmp = Z_HEADER_NAMESPACE_P(hdr_ret); if (Z_TYPE_P(tmp) == IS_STRING) { - smart_str_appendl(&key, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); + smart_str_append(&key, Z_STR_P(tmp)); smart_str_appendc(&key, ':'); hdr_ns = Z_STRVAL_P(tmp); } tmp = Z_HEADER_NAME_P(hdr_ret); if (Z_TYPE_P(tmp) == IS_STRING) { - smart_str_appendl(&key, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); + smart_str_append(&key, Z_STR_P(tmp)); hdr_name = Z_STRVAL_P(tmp); } smart_str_0(&key); @@ -3860,13 +3860,13 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, const char *fu tmp = Z_HEADER_NAMESPACE_P(&h->retval); if (Z_TYPE_P(tmp) == IS_STRING) { - smart_str_appendl(&key, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); + smart_str_append(&key, Z_STR_P(tmp)); smart_str_appendc(&key, ':'); hdr_ns = Z_STRVAL_P(tmp); } tmp = Z_HEADER_NAME_P(&h->retval); if (Z_TYPE_P(tmp) == IS_STRING) { - smart_str_appendl(&key, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp)); + smart_str_append(&key, Z_STR_P(tmp)); hdr_name = Z_STRVAL_P(tmp); } smart_str_0(&key); @@ -4102,9 +4102,9 @@ static xmlDocPtr serialize_function_call(zval *this_ptr, sdlFunctionPtr function smart_str key = {0}; sdlSoapBindingFunctionHeaderPtr hdr; - smart_str_appendl(&key, Z_STRVAL_P(ns), Z_STRLEN_P(ns)); + smart_str_append(&key, Z_STR_P(ns)); smart_str_appendc(&key, ':'); - smart_str_appendl(&key, Z_STRVAL_P(name), Z_STRLEN_P(name)); + smart_str_append(&key, Z_STR_P(name)); smart_str_0(&key); if ((hdr = zend_hash_find_ptr(hdrs, key.s)) != NULL) { hdr_use = hdr->use; @@ -4437,7 +4437,7 @@ static void type_to_string(sdlTypePtr type, smart_str *buf, int level) /* {{{ */ smart_str_appendc(&spaces, ' '); } if (spaces.s) { - smart_str_appendl(buf, ZSTR_VAL(spaces.s), ZSTR_LEN(spaces.s)); + smart_str_append(buf, spaces.s); } switch (type->kind) { case XSD_TYPEKIND_SIMPLE: @@ -4576,7 +4576,7 @@ static void type_to_string(sdlTypePtr type, smart_str *buf, int level) /* {{{ */ } if (enc) { if (spaces.s) { - smart_str_appendl(buf, ZSTR_VAL(spaces.s), ZSTR_LEN(spaces.s)); + smart_str_append(buf, spaces.s); } smart_str_appendc(buf, ' '); smart_str_appendl(buf, type->encode->details.type_str, strlen(type->encode->details.type_str)); @@ -4591,7 +4591,7 @@ static void type_to_string(sdlTypePtr type, smart_str *buf, int level) /* {{{ */ ZEND_HASH_FOREACH_PTR(type->attributes, attr) { if (spaces.s) { - smart_str_appendl(buf, ZSTR_VAL(spaces.s), ZSTR_LEN(spaces.s)); + smart_str_append(buf, spaces.s); } smart_str_appendc(buf, ' '); if (attr->encode && attr->encode->details.type_str) { @@ -4605,7 +4605,7 @@ static void type_to_string(sdlTypePtr type, smart_str *buf, int level) /* {{{ */ } ZEND_HASH_FOREACH_END(); } if (spaces.s) { - smart_str_appendl(buf, ZSTR_VAL(spaces.s), ZSTR_LEN(spaces.s)); + smart_str_append(buf, spaces.s); } smart_str_appendc(buf, '}'); } diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c index b5c06b84a6aa4..1891347e2a66b 100644 --- a/ext/standard/http_fopen_wrapper.c +++ b/ext/standard/http_fopen_wrapper.c @@ -515,7 +515,7 @@ static php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, } smart_str_appendl(&header, "CONNECT ", sizeof("CONNECT ")-1); - smart_str_appends(&header, ZSTR_VAL(resource->host)); + smart_str_append(&header, resource->host); smart_str_appendc(&header, ':'); smart_str_append_unsigned(&header, resource->port); smart_str_appendl(&header, " HTTP/1.0\r\n", sizeof(" HTTP/1.0\r\n")-1); @@ -630,7 +630,7 @@ static php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, /* file */ if (resource->path && ZSTR_LEN(resource->path)) { - smart_str_appends(&req_buf, ZSTR_VAL(resource->path)); + smart_str_append(&req_buf, resource->path); } else { smart_str_appendc(&req_buf, '/'); } @@ -638,7 +638,7 @@ static php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, /* query string */ if (resource->query) { smart_str_appendc(&req_buf, '?'); - smart_str_appends(&req_buf, ZSTR_VAL(resource->query)); + smart_str_append(&req_buf, resource->query); } } @@ -785,7 +785,7 @@ static php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, /* Send Host: header so name-based virtual hosts work */ if ((have_header & HTTP_HEADER_HOST) == 0) { smart_str_appends(&req_buf, "Host: "); - smart_str_appends(&req_buf, ZSTR_VAL(resource->host)); + smart_str_append(&req_buf, resource->host); if ((use_ssl && resource->port != 443 && resource->port != 0) || (!use_ssl && resource->port != 80 && resource->port != 0)) { smart_str_appendc(&req_buf, ':'); @@ -868,7 +868,7 @@ static php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, php_error_docref(NULL, E_NOTICE, "Content-type not specified assuming application/x-www-form-urlencoded"); } smart_str_appends(&req_buf, "\r\n"); - smart_str_appendl(&req_buf, Z_STRVAL_P(tmpzval), Z_STRLEN_P(tmpzval)); + smart_str_append(&req_buf, Z_STR_P(tmpzval)); } else { smart_str_appends(&req_buf, "\r\n"); } diff --git a/ext/standard/url_scanner_ex.re b/ext/standard/url_scanner_ex.re index 46254bf380853..f2adb8c864bdd 100644 --- a/ext/standard/url_scanner_ex.re +++ b/ext/standard/url_scanner_ex.re @@ -245,32 +245,32 @@ static inline void append_modified_url(smart_str *url, smart_str *dest, smart_st } if (url_parts->scheme) { - smart_str_appends(dest, ZSTR_VAL(url_parts->scheme)); + smart_str_append(dest, url_parts->scheme); smart_str_appends(dest, "://"); } else if (*(ZSTR_VAL(url->s)) == '/' && *(ZSTR_VAL(url->s)+1) == '/') { smart_str_appends(dest, "//"); } if (url_parts->user) { - smart_str_appends(dest, ZSTR_VAL(url_parts->user)); + smart_str_append(dest, url_parts->user); if (url_parts->pass) { - smart_str_appends(dest, ZSTR_VAL(url_parts->pass)); + smart_str_append(dest, url_parts->pass); smart_str_appendc(dest, ':'); } smart_str_appendc(dest, '@'); } if (url_parts->host) { - smart_str_appends(dest, ZSTR_VAL(url_parts->host)); + smart_str_append(dest, url_parts->host); } if (url_parts->port) { smart_str_appendc(dest, ':'); smart_str_append_unsigned(dest, (long)url_parts->port); } if (url_parts->path) { - smart_str_appends(dest, ZSTR_VAL(url_parts->path)); + smart_str_append(dest, url_parts->path); } smart_str_appendc(dest, '?'); if (url_parts->query) { - smart_str_appends(dest, ZSTR_VAL(url_parts->query)); + smart_str_append(dest, url_parts->query); smart_str_append(dest, separator); smart_str_append_smart_str(dest, url_app); } else { @@ -278,7 +278,7 @@ static inline void append_modified_url(smart_str *url, smart_str *dest, smart_st } if (url_parts->fragment) { smart_str_appendc(dest, '#'); - smart_str_appends(dest, ZSTR_VAL(url_parts->fragment)); + smart_str_append(dest, url_parts->fragment); } php_url_free(url_parts); } @@ -601,7 +601,7 @@ PHPAPI char *php_url_scanner_adapt_single_url(const char *url, size_t urllen, co if (encode) { encoded = php_raw_url_encode(name, strlen(name)); - smart_str_appendl(&url_app, ZSTR_VAL(encoded), ZSTR_LEN(encoded)); + smart_str_append(&url_app, encoded); zend_string_free(encoded); } else { smart_str_appends(&url_app, name); @@ -609,7 +609,7 @@ PHPAPI char *php_url_scanner_adapt_single_url(const char *url, size_t urllen, co smart_str_appendc(&url_app, '='); if (encode) { encoded = php_raw_url_encode(value, strlen(value)); - smart_str_appendl(&url_app, ZSTR_VAL(encoded), ZSTR_LEN(encoded)); + smart_str_append(&url_app, encoded); zend_string_free(encoded); } else { smart_str_appends(&url_app, value); @@ -760,13 +760,13 @@ static inline void php_url_scanner_add_var_impl(const char *name, size_t name_le if (encode) { encoded = php_raw_url_encode(name, name_len); - smart_str_appendl(&sname, ZSTR_VAL(encoded), ZSTR_LEN(encoded)); zend_string_free(encoded); + smart_str_append(&sname, encoded); zend_string_free(encoded); encoded = php_raw_url_encode(value, value_len); - smart_str_appendl(&svalue, ZSTR_VAL(encoded), ZSTR_LEN(encoded)); zend_string_free(encoded); + smart_str_append(&svalue, encoded); zend_string_free(encoded); encoded = php_escape_html_entities_ex((const unsigned char *) name, name_len, 0, ENT_QUOTES|ENT_SUBSTITUTE, NULL, /* double_encode */ 0, /* quiet */ 1); - smart_str_appendl(&hname, ZSTR_VAL(encoded), ZSTR_LEN(encoded)); zend_string_free(encoded); + smart_str_append(&hname, encoded); zend_string_free(encoded); encoded = php_escape_html_entities_ex((const unsigned char *) value, value_len, 0, ENT_QUOTES|ENT_SUBSTITUTE, NULL, /* double_encode */ 0, /* quiet */ 1); - smart_str_appendl(&hvalue, ZSTR_VAL(encoded), ZSTR_LEN(encoded)); zend_string_free(encoded); + smart_str_append(&hvalue, encoded); zend_string_free(encoded); } else { smart_str_appendl(&sname, name, name_len); smart_str_appendl(&svalue, value, value_len); @@ -867,14 +867,14 @@ static inline zend_result php_url_scanner_reset_var_impl(zend_string *name, int if (encode) { encoded = php_raw_url_encode(ZSTR_VAL(name), ZSTR_LEN(name)); - smart_str_appendl(&sname, ZSTR_VAL(encoded), ZSTR_LEN(encoded)); + smart_str_append(&sname, encoded); zend_string_free(encoded); encoded = php_escape_html_entities_ex((const unsigned char *) ZSTR_VAL(name), ZSTR_LEN(name), 0, ENT_QUOTES|ENT_SUBSTITUTE, SG(default_charset), /* double_encode */ 0, /* quiet */ 1); - smart_str_appendl(&hname, ZSTR_VAL(encoded), ZSTR_LEN(encoded)); + smart_str_append(&hname, encoded); zend_string_free(encoded); } else { - smart_str_appendl(&sname, ZSTR_VAL(name), ZSTR_LEN(name)); - smart_str_appendl(&hname, ZSTR_VAL(name), ZSTR_LEN(name)); + smart_str_append(&sname, name); + smart_str_append(&hname, name); } smart_str_0(&sname); smart_str_0(&hname);