Edit report at http://bugs.php.net/bug.php?id=53238&edit=1

 ID:                 53238
 Updated by:         [email protected]
 Reported by:        giovanni at giacobbi dot net
 Summary:            Make third parameter of preg_match_all optional
-Status:             Assigned
+Status:             Closed
 Type:               Feature/Change Request
 Package:            PCRE related
 Operating System:   any
 PHP Version:        5.3.3
 Assigned To:        aharvey
 Block user comment: N

 New Comment:

This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

This has been implemented on trunk, and should be in 5.4. (Assuming
that's what it's called.)


Previous Comments:
------------------------------------------------------------------------
[2010-11-05 05:37:29] [email protected]

Automatic comment from SVN on behalf of aharvey
Revision: http://svn.php.net/viewvc/?view=revision&revision=305097
Log: Implemented FR #53238 (Make third parameter of preg_match_all
optional).

------------------------------------------------------------------------
[2010-11-03 19:32:23] giovanni at giacobbi dot net

Description:
------------
I had to count the time a regular expression is in a string, and the
correct way to do this is with the return value of preg_match_all()
because preg_match() will always return either 0 or 1.

The problem is that preg_match_all() enforces the third parameter. My
request is to align the prototype of preg_match_all() to the one of
preg_match(), i.e. making the third parameter optional.



Test script:
---------------
$cnt = preg_match_all('/<br\s*\/?>/i', "this<br/>my<br>text");

var_dump($cnt);



Expected result:
----------------
int(2)



Actual result:
--------------
Warning: preg_match_all() expects at least 3 parameters, 2 given in - on
line 2

bool(false)




------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=53238&edit=1

Reply via email to