Bug #78853 [NEW]: preg_match() may return integer > 1
| From: | cmb@php.net | Date: | Thu, 21 Nov 2019 11:51:48 +0000 |
| Subject: | Bug #78853 [NEW]: preg_match() may return integer > 1 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-223831@lists.php.net to get a copy of this message | ||
From: cmb
Operating system: *
PHP version: 7.3.12
Package: PCRE related
Bug Type: Bug
Bug description:preg_match() may return integer > 1
Description:
------------
As of PHP 7.3.0, preg_match() may return an integer greater than
one on success[1], although the documentation states[2]:
| preg_match() returns 1 if the pattern matches given subject, [â¦]
This issue has been reported by Falko Matthies.
[1] <https://3v4l.org/cKarY>
[2]
<https://www.php.net/manual/en/function.preg-match.php#refsect1-function.preg-match-returnvalues>
Test script:
---------------
var_dump(preg_match('/^|\d{1,2}$/', "7"));
Expected result:
----------------
int(1)
Actual result:
--------------
int(2)
--
Edit bug report at https://bugs.php.net/bug.php?id=78853&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=78853&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=78853&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=78853&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=78853&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=78853&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=78853&r=support
Expected behavior: https://bugs.php.net/fix.php?id=78853&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=78853&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=78853&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=78853&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=78853&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=78853&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=78853&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=78853&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=78853&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=78853&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=78853&r=mysqlcfg