Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Zend/zend.c
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +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);
smart_str_appends(buf, ZSTR_VAL(class_name));
smart_str_append(buf, class_name);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably ditto.

zend_string_release_ex(class_name, 0);

if (!(zobj->ce->ce_flags & ZEND_ACC_ENUM)) {
Expand Down
6 changes: 3 additions & 3 deletions Zend/zend_ast.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions Zend/zend_exceptions.c
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ ZEND_METHOD(ErrorException, getSeverity)
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)); \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"The devil is in the details". I think this little change causes all sort of problems, i.e. strlen() usage vs ZSTR_LEN()

} \
} \
} while (0)
Expand Down Expand Up @@ -532,7 +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(");
smart_str_appends(str, ZSTR_VAL(class_name));
smart_str_append(str, class_name);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be looked at too.

smart_str_appends(str, "), ");
zend_string_release_ex(class_name, 0);
break;
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_inheritance.c
Original file line number Diff line number Diff line change
Expand Up @@ -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, "::");
}
Expand Down
2 changes: 1 addition & 1 deletion ext/iconv/iconv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions ext/intl/locale/locale_methods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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);
Expand All @@ -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 {
Expand Down Expand Up @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion ext/mbstring/php_mbregex.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
8 changes: 4 additions & 4 deletions ext/opcache/jit/zend_jit.c
Original file line number Diff line number Diff line change
Expand Up @@ -880,21 +880,21 @@ 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);
}
smart_str_0(&buf);
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 {
Expand Down
8 changes: 4 additions & 4 deletions ext/opcache/jit/zend_jit_trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion ext/phar/phar.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion ext/reflection/php_reflection.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
42 changes: 21 additions & 21 deletions ext/soap/php_http.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -574,32 +574,32 @@ 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");
} else {
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);
Expand All @@ -615,15 +615,15 @@ 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 &&
(tmp = php_stream_context_get_option(context, "http", "user_agent")) != NULL &&
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)) {
Expand All @@ -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");
}
Expand All @@ -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");
Expand Down Expand Up @@ -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) {
Expand All @@ -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 {
Expand Down Expand Up @@ -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));
Expand Down
4 changes: 2 additions & 2 deletions ext/soap/php_sdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

Expand All @@ -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));
Expand Down
Loading