Skip to content

Commit 70ecb6e

Browse files
committed
Fix #76706: mbstring.http_output_conv_mimetypes is ignored
_php_mb_match_regex() is supposed to return != 0 on success, and 0 on failure. pcre2_match() returns >= 0 on success, and < 0 on failure. We map the result accordingly. Since this patch fixes four failing tests, there is no need to add another.
1 parent 99020cc commit 70ecb6e

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ PHP NEWS
55
- mbstring:
66
. Fixed bug #76704 (mb_detect_order return value varies based on argument
77
type). (cmb)
8+
. Fixed bug #76706 (mbstring.http_output_conv_mimetypes is ignored). (cmb)
89

910
- phpdbg:
1011
. Fixed bug #76595 (phpdbg man page contains outdated information).

ext/mbstring/mbstring.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,7 @@ static int _php_mb_match_regex(void *opaque, const char *str, size_t str_len)
10681068
php_error_docref(NULL, E_WARNING, "Cannot allocate match data");
10691069
return FAILURE;
10701070
}
1071-
res = pcre2_match(opaque, (PCRE2_SPTR)str, str_len, 0, 0, match_data, php_pcre_mctx());
1071+
res = pcre2_match(opaque, (PCRE2_SPTR)str, str_len, 0, 0, match_data, php_pcre_mctx()) >= 0;
10721072
php_pcre_free_match_data(match_data);
10731073

10741074
return res;

0 commit comments

Comments
 (0)