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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Tue Sep 09 03:00:01 2025 UTC