Skip to content

Commit 6f3447a

Browse files
authored
Merge pull request #1883 from Phillip85/3.x
add error_clear_last() to rename and copy
2 parents 200c084 + fb5c17e commit 6f3447a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/Local/LocalFilesystemAdapter.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ public function move(string $source, string $destination, Config $config): void
252252
$this->resolveDirectoryVisibility($config->get(Config::OPTION_DIRECTORY_VISIBILITY))
253253
);
254254

255+
error_clear_last();
255256
if ( ! @rename($sourcePath, $destinationPath)) {
256257
throw UnableToMoveFile::because(error_get_last()['message'] ?? 'unknown reason', $source, $destination);
257258
}
@@ -271,6 +272,7 @@ public function copy(string $source, string $destination, Config $config): void
271272
$this->resolveDirectoryVisibility($config->get(Config::OPTION_DIRECTORY_VISIBILITY))
272273
);
273274

275+
error_clear_last();
274276
if ($sourcePath !== $destinationPath && ! @copy($sourcePath, $destinationPath)) {
275277
throw UnableToCopyFile::because(error_get_last()['message'] ?? 'unknown', $source, $destination);
276278
}

0 commit comments

Comments
 (0)