php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49673 preg_match_all returns false when third arument is omitted
Submitted: 2009-09-25 19:22 UTC Modified: 2009-09-26 11:52 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: mfthemon at gmail dot com Assigned:
Status: Not a bug Package: PCRE related
PHP Version: 5.3.0 OS: win2k7server
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: mfthemon at gmail dot com
New email:
PHP Version: OS:

 

 [2009-09-25 19:22 UTC] mfthemon at gmail dot com
Description:
------------
preg_match_all doesn't return matches count when the third argument is 
omitted.


Reproduce code:
---------------
var_dump(preg_match_all('/b\([\w\W]*?\)/', 'b(2)b(4)b(5)b(8)b(2)b(18)'));

Expected result:
----------------
int(6)

Actual result:
--------------
bool(false)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-09-25 21:49 UTC] jani@php.net
RTFM: "Returns the number of full pattern matches (which might be zero), 
or FALSE if an error occurred."

And might the error perhaps be that the 3rd parameter is NOT optional? 
:)
 [2009-09-26 11:52 UTC] mfthemon at gmail dot com
oh, my bad.)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 19 12:01:30 2024 UTC