Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3278915

Browse files
committed
bug#23168 [Config] Fix ** GlobResource on Windows (nicolas-grekas)
This PR was merged into the 3.3 branch.Discussion----------[Config] Fix ** GlobResource on Windows| Q | A| ------------- | ---| Branch? | 3.3| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets |#23103| License | MIT| Doc PR | -We cannot tell Finder to use RecursiveDirectoryIterator::UNIX_PATHS so we have to fix paths on Windows.Commits-------44955be [Config] Fix ** GlobResource on Windows
2 parentsa63400a +44955be commit3278915

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

‎src/Symfony/Component/Config/Resource/GlobResource.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ function (\SplFileInfo $file) { return '.' !== $file->getBasename()[0]; }
134134

135135
$prefixLen =strlen($this->prefix);
136136
foreach ($finder->followLinks()->sortByName()->in($this->prefix)as$path =>$info) {
137-
if (preg_match($regex,substr($path,$prefixLen)) &&$info->isFile()) {
137+
if (preg_match($regex,substr('\\' === \DIRECTORY_SEPARATOR ?str_replace('\\','/',$path) :$path,$prefixLen)) &&$info->isFile()) {
138138
yield$path =>$info;
139139
}
140140
}

‎src/Symfony/Component/Config/Tests/Resource/GlobResourceTest.php‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@ public function testIterator()
3636
$this->assertEquals(array($file =>new \SplFileInfo($file)),$paths);
3737
$this->assertInstanceOf('SplFileInfo',current($paths));
3838
$this->assertSame($dir,$resource->getPrefix());
39+
40+
$resource =newGlobResource($dir,'/**/Resource',true);
41+
42+
$paths =iterator_to_array($resource);
43+
44+
$file =$dir.DIRECTORY_SEPARATOR.'Resource'.DIRECTORY_SEPARATOR.'ConditionalClass.php';
45+
$this->assertEquals(array($file =>$file),$paths);
46+
$this->assertInstanceOf('SplFileInfo',current($paths));
47+
$this->assertSame($dir,$resource->getPrefix());
3948
}
4049

4150
publicfunctiontestIsFreshNonRecursiveDetectsNewFile()

‎src/Symfony/Component/Config/composer.json‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@
2020
"symfony/filesystem":"~2.8|~3.0"
2121
},
2222
"require-dev": {
23+
"symfony/finder":"~3.3",
2324
"symfony/yaml":"~3.0",
2425
"symfony/dependency-injection":"~3.3"
2526
},
2627
"conflict": {
28+
"symfony/finder":"<3.3",
2729
"symfony/dependency-injection":"<3.3"
2830
},
2931
"suggest": {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp