Merge branch 'PHP-7.3' into PHP-7.4

* PHP-7.3:
  Fix #78853: preg_match() may return integer > 1
This commit is contained in:
Christoph M. Becker 2019-11-22 19:28:49 +01:00
commit cfb643ca2b
3 changed files with 16 additions and 1 deletions

3
NEWS
View File

@ -18,6 +18,9 @@ PHP NEWS
. Fixed $x = (bool)$x; with opcache (should emit undeclared variable notice).
(Tyson Andre)
- PCRE:
. Fixed bug #78853 (preg_match() may return integer > 1). (cmb)
?? ??? ????, PHP 7.4.0RC6
- Core:

View File

@ -1359,7 +1359,11 @@ matched:
count = pcre2_match(pce->re, (PCRE2_SPTR)subject, subject_len, start_offset2,
PCRE2_NO_UTF_CHECK | PCRE2_NOTEMPTY_ATSTART | PCRE2_ANCHORED, match_data, mctx);
if (count >= 0) {
goto matched;
if (global) {
goto matched;
} else {
break;
}
} else if (count == PCRE2_ERROR_NOMATCH) {
/* If we previously set PCRE2_NOTEMPTY_ATSTART after a null match,
this is not necessarily the end. We need to advance

View File

@ -0,0 +1,8 @@
--TEST--
Bug #78853 (preg_match() may return integer > 1)
--FILE--
<?php
var_dump(preg_match('/^|\d{1,2}$/', "7"));
?>
--EXPECT--
int(1)