Skip to content

Commit e6d9544

Browse files
committed
ext/mbstring: Pass string length to _php_mb_ini_mbstring_http_output_set()
1 parent 3e17afd commit e6d9544

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
@@ -757,7 +757,7 @@ static PHP_INI_MH(OnUpdate_mbstring_http_input)
757757
}
758758
/* }}} */
759759

760-
static zend_result _php_mb_ini_mbstring_http_output_set(const char *new_value) {
760+
static zend_result _php_mb_ini_mbstring_http_output_set(const char *new_value, size_t length) {
761761
const mbfl_encoding *encoding = php_mb_get_encoding_or_pass(new_value);
762762
if (!encoding) {
763763
return FAILURE;
@@ -776,13 +776,14 @@ static PHP_INI_MH(OnUpdate_mbstring_http_output)
776776
}
777777

778778
if (new_value == NULL || ZSTR_LEN(new_value) == 0) {
779+
const char *encoding = php_get_output_encoding();
779780
MBSTRG(http_output_set) = 0;
780-
_php_mb_ini_mbstring_http_output_set(php_get_output_encoding());
781+
_php_mb_ini_mbstring_http_output_set(encoding, strlen(encoding));
781782
return SUCCESS;
782783
}
783784

784785
MBSTRG(http_output_set) = 1;
785-
return _php_mb_ini_mbstring_http_output_set(ZSTR_VAL(new_value));
786+
return _php_mb_ini_mbstring_http_output_set(ZSTR_VAL(new_value), ZSTR_LEN(new_value));
786787
}
787788
/* }}} */
788789

@@ -964,7 +965,7 @@ static void mbstring_internal_encoding_changed_hook(void) {
964965

965966
if (!MBSTRG(http_output_set)) {
966967
const char *encoding = php_get_output_encoding();
967-
_php_mb_ini_mbstring_http_output_set(encoding);
968+
_php_mb_ini_mbstring_http_output_set(encoding, strlen(encoding));
968969
}
969970

970971
if (!MBSTRG(http_input_set)) {

0 commit comments

Comments
 (0)