Skip to content

Commit b61479b

Browse files
committed
ext/mbstring: Pass string length to _php_mb_ini_mbstring_http_output_set()
1 parent a707863 commit b61479b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

ext/mbstring/mbstring.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,7 @@ static PHP_INI_MH(OnUpdate_mbstring_http_input)
760760
}
761761
/* }}} */
762762

763-
static zend_result _php_mb_ini_mbstring_http_output_set(const char *new_value) {
763+
static zend_result _php_mb_ini_mbstring_http_output_set(const char *new_value, size_t length) {
764764
const mbfl_encoding *encoding = php_mb_get_encoding_or_pass(new_value);
765765
if (!encoding) {
766766
return FAILURE;
@@ -779,13 +779,14 @@ static PHP_INI_MH(OnUpdate_mbstring_http_output)
779779
}
780780

781781
if (new_value == NULL || ZSTR_LEN(new_value) == 0) {
782+
const char *encoding = php_get_output_encoding();
782783
MBSTRG(http_output_set) = 0;
783-
_php_mb_ini_mbstring_http_output_set(php_get_output_encoding());
784+
_php_mb_ini_mbstring_http_output_set(encoding, strlen(encoding));
784785
return SUCCESS;
785786
}
786787

787788
MBSTRG(http_output_set) = 1;
788-
return _php_mb_ini_mbstring_http_output_set(ZSTR_VAL(new_value));
789+
return _php_mb_ini_mbstring_http_output_set(ZSTR_VAL(new_value), ZSTR_LEN(new_value));
789790
}
790791
/* }}} */
791792

@@ -966,7 +967,7 @@ static void mbstring_internal_encoding_changed_hook(void) {
966967

967968
if (!MBSTRG(http_output_set)) {
968969
const char *encoding = php_get_output_encoding();
969-
_php_mb_ini_mbstring_http_output_set(encoding);
970+
_php_mb_ini_mbstring_http_output_set(encoding, strlen(encoding));
970971
}
971972

972973
if (!MBSTRG(http_input_set)) {

0 commit comments

Comments
 (0)