8000 merged branch vicb/finder/regex (PR #4699) · mageekguy/symfony@dd1115a · GitHub
[go: up one dir, main page]

Skip to content

Commit dd1115a

Browse files
committed
merged branch vicb/finder/regex (PR symfony#4699)
Commits ------- 4d09fe6 [Finder] '*' and '?' are considered are glob pattern rather than delimiters (fix symfony#4664) Discussion ---------- [Finder] '*' and '?' are considered are glob pattern rather than delimit... ...ers (fix symfony#4664)
2 parents b6e4fd0 + 4d09fe6 commit dd1115a

File tree

3 files changed

+5
-1
lines changed
< 8000 div class="Box-sc-g0xbh4-0 prc-PageLayout-ContentWrapper-b-QRo Commit-module__SplitPageLayout_Content--ZY6yu" data-is-hidden="false">

3 files changed

+5
-1
lines changed

src/Symfony/Component/Finder/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ CHANGELOG
1212
* added searching based on the file content via Finder::contains() and
1313
Finder::notContains()
1414
* added support for the != operator in the Comparator
15+
* [BC BREAK] filter expressions (used for file name and content) are no more
16+
considered as regexps but glob patterns when they are enclosed in '*' or '?'

src/Symfony/Component/Finder/Iterator/MultiplePcreFilterIterator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ protected function isRegex($str)
5858
$end = substr($m[1], -1);
5959

6060
if ($start === $end) {
61-
return !preg_match('/[[:alnum:] \\\\]/', $start);
61+
return !preg_match('/[*?[:alnum:] \\\\]/', $start);
6262
}
6363

6464
if ($start === '{' && $end === '}') {

src/Symfony/Component/Finder/Tests/Iterator/MultiplePcreFilterIteratorTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ public function getIsRegexFixtures()
3838
array('/foo/imsxu', true, 'valid regex with multiple modifiers'),
3939
array('#foo#', true, '"#" is a valid delimiter'),
4040
array('{foo}', true, '"{,}" is a valid delimiter pair'),
41+
array('*foo.*', false, '"*" is not considered as a valid delimiter'),
42+
array('?foo.?', false, '"?" is not considered as a valid delimiter'),
4143
);
4244
}
4345
}

0 commit comments

Comments
 (0)
0