Skip to content

Commit 5ca664a

Browse files
committed
added test to clearly show distinction between unset (aka unmatched) subpattern and an empty match
1 parent 303b365 commit 5ca664a

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

ext/pcre/tests/bug61780.phpt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
--TEST--
2+
Bug #61780 (Inconsistent PCRE captures in match results): basics
3+
--FILE--
4+
<?php
5+
preg_match('/(a)?([a-z]*)(\d*)/', '123', $matches);
6+
var_dump($matches);
7+
?>
8+
--EXPECT--
9+
array(4) {
10+
[0]=>
11+
string(3) "123"
12+
[1]=>
13+
NULL
14+
[2]=>
15+
string(0) ""
16+
[3]=>
17+
string(3) "123"
18+
}

0 commit comments

Comments
 (0)