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
 [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: Mon May 27 21:01:33 2024 UTC