]> granicus.if.org Git - php/commitdiff
Fix #76706: mbstring.http_output_conv_mimetypes is ignored
authorChristoph M. Becker <cmbecker69@gmx.de>
Sat, 4 Aug 2018 21:24:04 +0000 (23:24 +0200)
committerChristoph M. Becker <cmbecker69@gmx.de>
Sat, 4 Aug 2018 21:24:04 +0000 (23:24 +0200)
_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.

NEWS
ext/mbstring/mbstring.c

diff --git a/NEWS b/NEWS
index 4bfe2168d57bf221deee25c2e701d7c87fddcc9d..2765c7dcff9e7aeb648aa0fc1ee509e3456cab59 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,7 @@ PHP                                                                        NEWS
 - mbstring:
   . Fixed bug #76704 (mb_detect_order return value varies based on argument
     type). (cmb)
+  . Fixed bug #76706 (mbstring.http_output_conv_mimetypes is ignored). (cmb)
 
 - phpdbg:
   . Fixed bug #76595 (phpdbg man page contains outdated information).
index bb464d0008de1720bee0cd8c3b4c8d856a988b94..cdecd99385f47e95dff608c1d23614741ff48387 100644 (file)
@@ -1068,7 +1068,7 @@ static int _php_mb_match_regex(void *opaque, const char *str, size_t str_len)
                php_error_docref(NULL, E_WARNING, "Cannot allocate match data");
                return FAILURE;
        }
-       res = pcre2_match(opaque, (PCRE2_SPTR)str, str_len, 0, 0, match_data, php_pcre_mctx());
+       res = pcre2_match(opaque, (PCRE2_SPTR)str, str_len, 0, 0, match_data, php_pcre_mctx()) >= 0;
        php_pcre_free_match_data(match_data);
 
        return res;