Skip to content

Commit

Permalink
Fixed error on unlink when no such file or directory (#2675)
Browse files Browse the repository at this point in the history
  • Loading branch information
luigifab authored and fballiano committed Jan 13, 2023
1 parent 1990768 commit e95dd61
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/Varien/Io/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ public function rmdir($dir, $recursive = false)
*/
public static function rmdirRecursive($dir, $recursive = true)
{
$result = true;
if ($recursive) {
if (is_dir($dir)) {
foreach (scandir($dir) as $item) {
Expand All @@ -410,7 +411,7 @@ public static function rmdirRecursive($dir, $recursive = true)
self::rmdirRecursive($dir . "/" . $item, $recursive);
}
$result = @rmdir($dir);
} else {
} elseif (file_exists($dir)) {
$result = @unlink($dir);
}
} else {
Expand Down

0 comments on commit e95dd61

Please sign in to comment.