Skip to content

Commit 7c197f0

Browse files
committedJan 21, 2019
validate: php: remove named capture groups from result
For consistency with other query-X
1 parent 26b94d5 commit 7c197f0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed
 

‎src/validate/src/php/query-php.php

+8
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ function main() {
4545
if ($matched) {
4646
$obj->{'matchContents'} = new stdClass();
4747
$obj->{'matchContents'}->{'matchedString'} = $matches[0];
48+
49+
// Unset any capture groups keyed by name instead of number for consistency with other testers
50+
foreach ($matches as $key => $value) {
51+
if (!is_int($key)) {
52+
unset($matches[$key]);
53+
}
54+
}
55+
4856
$obj->{'matchContents'}->{'captureGroups'} = array_slice($matches, 1);
4957
}
5058
$obj->{'inputLength'} = strlen($obj->{'input'});

0 commit comments

Comments
 (0)
Please sign in to comment.