From 57a0458d099ccd0002f6644990d5b8deb60c7b32 Mon Sep 17 00:00:00 2001 From: mreiden Date: Thu, 5 Aug 2021 21:09:15 -0500 Subject: [PATCH] Avoid a file exists error instead of supressing it Suppressing the mkdir error causes a lot of noise in symfony dev logs if there are multiple files in a subdirectory of the tar file. Skip trying to create the subdirectory if it already exists. --- src/Tar.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Tar.php b/src/Tar.php index c48e808..4af9651 100644 --- a/src/Tar.php +++ b/src/Tar.php @@ -166,7 +166,9 @@ public function extract($outdir, $strip = '', $exclude = '', $include = '') // create output directory $output = $outdir.'/'.$fileinfo->getPath(); $directory = ($fileinfo->getIsdir()) ? $output : dirname($output); - @mkdir($directory, 0777, true); + if (!file_exists($directory)) { + mkdir($directory, 0777, true); + } // extract data if (!$fileinfo->getIsdir()) {