Skip to content

Commit

Permalink
Fix error when vendor dir contains broken symlinks (#11670)
Browse files Browse the repository at this point in the history
  • Loading branch information
vtsykun committed Oct 6, 2023
1 parent cb363b0 commit 3e22e1c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Composer/Util/Filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,10 +251,13 @@ public function ensureDirectoryExists(string $directory)
$directory.' exists and is not a directory.'
);
}

if (is_link($directory) && !@$this->unlinkImplementation($directory)) {
throw new \RuntimeException('Could not delete symbolic link '.$directory.': '.(error_get_last()['message'] ?? ''));
}

if (!@mkdir($directory, 0777, true)) {
throw new \RuntimeException(
$directory.' does not exist and could not be created.'
);
throw new \RuntimeException($directory.' does not exist and could not be created: '.(error_get_last()['message'] ?? ''));
}
}
}
Expand Down

0 comments on commit 3e22e1c

Please sign in to comment.