|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78853 preg_match() may return integer > 1
Submitted: 2019-11-21 11:51 UTC Modified: 2019-11-21 11:51 UTC
From: Assigned: cmb (profile)
Status: Closed Package: PCRE related
PHP Version: 7.3.12 OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
New email:
PHP Version: OS:


 [2019-11-21 11:51 UTC]
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] <>
[2] <>

Test script:
var_dump(preg_match('/^|\d{1,2}$/', "7"));

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2019-11-21 11:51 UTC]
-Assigned To: +Assigned To: cmb
 [2019-11-22 18:31 UTC]
Automatic comment on behalf of
Log: Fix #78853: preg_match() may return integer &gt; 1
 [2019-11-22 18:31 UTC]
-Status: Assigned +Status: Closed
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Feb 24 08:01:27 2024 UTC