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
 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 21:01:27 2024 UTC