Commit f40b356ad9f for php.net
commit f40b356ad9ff35d2716e4b0afb69090112c7edbe
Author: Gina Peter Banyard <girgias@php.net>
Date: Sat Mar 21 17:06:14 2026 +0000
Use smart_str_append() if we have a zend_string* (#21414)
diff --git a/Zend/zend.c b/Zend/zend.c
index bce1faede8f..af0013220f2 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 9d93c4d2225..e6270262e45 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 52e3ab00925..bc794fa3b90 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 ba13a3233ed..bfa709ba60b 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 7c812f5af44..13dc7074b9b 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 5cf6928a8cd..8f09e5c116e 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 a819def4b5b..a830d978db7 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 3ffb669e847..81bbaec04cd 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 2fcfaf96ab2..3a676125b80 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 61901703863..bb08af18ff8 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 ee49d2d90f5..ac3f64fed23 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 bac21d26b35..05a37bd1b9a 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 ad37867dd46..83a6b1d5a98 100644
--- a/ext/soap/php_sdl.c
+++ b/ext/soap/php_sdl.c
@@ -3240,7 +3240,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");
}
@@ -3250,7 +3250,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 ba145c5497f..c06ca0f4a1f 100644
--- a/ext/soap/soap.c
+++ b/ext/soap/soap.c
@@ -3372,7 +3372,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;
@@ -3609,14 +3609,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);
@@ -3842,13 +3842,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);
@@ -4084,9 +4084,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;
@@ -4419,7 +4419,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:
@@ -4558,7 +4558,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_appends(buf, type->encode->details.type_str);
@@ -4573,7 +4573,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) {
@@ -4587,7 +4587,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 b5c06b84a6a..1891347e2a6 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 46254bf3808..f2adb8c864b 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);