php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #62161 Incorrect definition of return value for preg_match
Submitted: 2012-05-25 17:52 UTC Modified: 2012-07-30 03:39 UTC
From: stiles dot nathan at gmail dot com Assigned: googleguy (profile)
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: N/A
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: stiles dot nathan at gmail dot com
New email:
PHP Version: OS:

 

 [2012-05-25 17:52 UTC] stiles dot nathan at gmail dot com
Description:
------------
My suggested definition of preg_match return value...

preg_match returns 1 if a match is found, 0 if no match is found and FALSE if an 
error occured.

And take out the info about preg_match_all as it has little to do with the return 
value.  This function is listed in related so it should be fine.


Expected result:
----------------
Simple definition..."preg_match() returns the number of times pattern matches."... 
this statement is TOTALLY false and misleading.

Actual result:
--------------
Border line dark pattern.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-07-30 02:29 UTC] googleguy@php.net
You're right. I can no see no reason why this shouldn't be the documented 
behavior. preg_match() will only ever return 0, 1, or false.
 [2012-07-30 03:37 UTC] googleguy@php.net
Automatic comment from SVN on behalf of googleguy
Revision: http://svn.php.net/viewvc/?view=revision&revision=326871
Log: Modified ambiguous wording for return values and added return.falseproblem warning. This fixes Bug #62161
 [2012-07-30 03:39 UTC] googleguy@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 [2012-07-30 03:39 UTC] googleguy@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: googleguy
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Oct 07 13:00:02 2026 UTC