Skip to content

Commit 2f65895

Browse files
committed
ext/mbstring: Pass string length to _php_mb_ini_mbstring_http_output_set()
1 parent 93ba579 commit 2f65895

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
@@ -761,7 +761,7 @@ static PHP_INI_MH(OnUpdate_mbstring_http_input)
761761
}
762762
/* }}} */
763763

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

782782
if (new_value == NULL || ZSTR_LEN(new_value) == 0) {
783+
const char *encoding = php_get_output_encoding();
783784
MBSTRG(http_output_set) = 0;
784-
_php_mb_ini_mbstring_http_output_set(php_get_output_encoding());
785+
_php_mb_ini_mbstring_http_output_set(encoding, strlen(encoding));
785786
return SUCCESS;
786787
}
787788

788789
MBSTRG(http_output_set) = 1;
789-
return _php_mb_ini_mbstring_http_output_set(ZSTR_VAL(new_value));
790+
return _php_mb_ini_mbstring_http_output_set(ZSTR_VAL(new_value), ZSTR_LEN(new_value));
790791
}
791792
/* }}} */
792793

@@ -968,7 +969,7 @@ static void mbstring_internal_encoding_changed_hook(void) {
968969

969970
if (!MBSTRG(http_output_set)) {
970971
const char *encoding = php_get_output_encoding();
971-
_php_mb_ini_mbstring_http_output_set(encoding);
972+
_php_mb_ini_mbstring_http_output_set(encoding, strlen(encoding));
972973
}
973974

974975
if (!MBSTRG(http_input_set)) {

0 commit comments

Comments
 (0)