From 45f22aca2e455f2df3fdb0f7ae91563cf388e407 Mon Sep 17 00:00:00 2001 From: Harold Claus Date: Thu, 27 Sep 2018 11:42:25 +0200 Subject: [PATCH] Fix for removing the dirs while creating a TAR archive The bug caused issues during the export of analytics data from advanced reporting. The scandir has parameter were the sort can be placed, but using UNSORTED gives you unwanted lists of files/dirs. Therefor deleting the first 2 via array_shift, is not a proper way of dealing with this Signed-off-by: Harold Claus --- lib/internal/Magento/Framework/Archive/Tar.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/internal/Magento/Framework/Archive/Tar.php b/lib/internal/Magento/Framework/Archive/Tar.php index 7fe1255e5b859..0a74753077c49 100644 --- a/lib/internal/Magento/Framework/Archive/Tar.php +++ b/lib/internal/Magento/Framework/Archive/Tar.php @@ -259,10 +259,7 @@ protected function _createTar($skipRoot = false, $finalize = false) ); } - array_shift($dirFiles); - /* remove './'*/ - array_shift($dirFiles); - /* remove '../'*/ + $dirFiles = array_diff($dirFiles, ['..', '.']); foreach ($dirFiles as $item) { $this->_setCurrentFile($file . $item)->_createTar();