Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 07e1d25

Browse files
committed
bug symfony#15121 fixed symfony#15118 [Filesystem] mirroring a symlink copies absolute file path (danepowell)
This PR was submitted for the 2.6 branch but it was merged into the 2.3 branch instead (closes symfony#15121). Discussion ---------- fixed symfony#15118 [Filesystem] mirroring a symlink copies absolute file path | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | symfony#15118 | License | MIT | Doc PR | This reverts the code change in a8b8d33 and adjusting the test case accordingly. Commits ------- a83d525 fixed symfony#15118 [Filesystem] mirroring a symlink copies absolute file path
2 parents 2a0f6fb + a83d525 commit 07e1d25

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Symfony/Component/Filesystem/Filesystem.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ public function mirror($originDir, $targetDir, \Traversable $iterator = null, $o
402402
}
403403
} else {
404404
if (is_link($file)) {
405-
$this->symlink($file->getRealPath(), $target);
405+
$this->symlink($file->getLinkTarget(), $target);
406406
} elseif (is_dir($file)) {
407407
$this->mkdir($target);
408408
} elseif (is_file($file)) {

src/Symfony/Component/Filesystem/Tests/FilesystemTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,7 @@ public function testMirrorCopiesRelativeLinkedContents()
906906
$this->assertTrue(is_dir($targetPath));
907907
$this->assertFileEquals($sourcePath.'/nested/file1.txt', $targetPath.DIRECTORY_SEPARATOR.'link1/file1.txt');
908908
$this->assertTrue(is_link($targetPath.DIRECTORY_SEPARATOR.'link1'));
909-
$this->assertEquals($sourcePath.'nested', readlink($targetPath.DIRECTORY_SEPARATOR.'link1'));
909+
$this->assertEquals('nested', readlink($targetPath.DIRECTORY_SEPARATOR.'link1'));
910910
}
911911

912912
/**

0 commit comments

Comments
 (0)