php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62677 preg_match_all: Useless without optional parameters
Submitted: 2012-07-27 13:09 UTC Modified: 2012-07-27 16:11 UTC
From: David dot Dvorak at bnv-tech dot cz Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: Irrelevant OS: ubuntu3.2
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: David dot Dvorak at bnv-tech dot cz
New email:
PHP Version: OS:

 

 [2012-07-27 13:09 UTC] David dot Dvorak at bnv-tech dot cz
Description:
------------
The preg_match_all function always returns false if it is used with only mandatory parameters.

Test script:
---------------
var_dump(preg_match_all('/[^0-9\.]/', '455asdf'));

Expected result:
----------------
int(4)


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-07-27 14:30 UTC] rasmus@php.net
That's a documentation bug. $matches is not optional in preg_match_all()
 [2012-07-27 14:30 UTC] rasmus@php.net
-Package: *Regular Expressions +Package: Documentation problem
 [2012-07-27 16:11 UTC] salathe@php.net
The behaviour was changed as of 5.4.0, making the third parameter optional.  This 
is clearly noted on the preg_match_all() docs page [1], and in the ChangeLog [2].

[1] http://php.net/manual/en/function.preg-match-all.php
[2] http://php.net/ChangeLog-5.php#5.4.0
 [2012-07-27 16:11 UTC] salathe@php.net
-Status: Open +Status: Not a bug
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 02 14:01:36 2025 UTC