From f08a19d0ee62362dfb64596377fe786c3f95cd09 Mon Sep 17 00:00:00 2001 From: Harold Claus Date: Sun, 30 Sep 2018 15:15:22 +0200 Subject: [PATCH 1/2] 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(); From 39e0ad9a72f528b9ab64894cdcaf436fa8ba9827 Mon Sep 17 00:00:00 2001 From: Ihor Sviziev Date: Mon, 1 Oct 2018 05:46:57 +0300 Subject: [PATCH 2/2] Fix static test --- lib/internal/Magento/Framework/Archive/Tar.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/internal/Magento/Framework/Archive/Tar.php b/lib/internal/Magento/Framework/Archive/Tar.php index 0a74753077c49..a858b2411515a 100644 --- a/lib/internal/Magento/Framework/Archive/Tar.php +++ b/lib/internal/Magento/Framework/Archive/Tar.php @@ -4,15 +4,15 @@ * See COPYING.txt for license details. */ +namespace Magento\Framework\Archive; + +use Magento\Framework\Archive\Helper\File; + /** * Class to work with tar archives * * @author Magento Core Team */ -namespace Magento\Framework\Archive; - -use Magento\Framework\Archive\Helper\File; - class Tar extends \Magento\Framework\Archive\AbstractArchive implements \Magento\Framework\Archive\ArchiveInterface { /**