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

Appearance settings

Commit c72eace

Browse filesBrowse files
[Filesystem] Fix false positive in ->remove()
1 parent 6d5dbf7 commit c72eace
Copy full SHA for c72eace

File tree

Expand file treeCollapse file tree

2 files changed

+4
-5
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+4
-5
lines changed

‎src/Symfony/Component/Filesystem/Filesystem.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Filesystem/Filesystem.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,9 @@ public function remove($files)
156156
$error = error_get_last();
157157
throw new IOException(sprintf('Failed to remove directory "%s": %s.', $file, $error['message']));
158158
}
159-
} elseif ($this->exists($file)) {
160-
if (!@unlink($file)) {
161-
$error = error_get_last();
159+
} elseif (!@unlink($file)) {
160+
$error = error_get_last();
161+
if (file_exists($file)) {
162162
throw new IOException(sprintf('Failed to remove file "%s": %s.', $file, $error['message']));
163163
}
164164
}

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Filesystem/Tests/FilesystemTest.php
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ public static function setUpBeforeClass()
3838
if ('\\' === DIRECTORY_SEPARATOR && null === self::$symlinkOnWindows) {
3939
$target = tempnam(sys_get_temp_dir(), 'sl');
4040
$link = sys_get_temp_dir().'/sl'.microtime(true).mt_rand();
41-
if (@symlink($target, $link)) {
42-
self::$symlinkOnWindows = @is_link($link);
41+
if (self::$symlinkOnWindows = @symlink($target, $link)) {
4342
unlink($link);
4443
}
4544
unlink($target);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.