From 81f2600e5e7157171ef0ef365603f4d276fdeb75 Mon Sep 17 00:00:00 2001 From: vitaliyboyko Date: Thu, 17 May 2018 21:29:04 +0300 Subject: [PATCH 1/2] Handle empty or incorrect lines in a language CSV --- .../Magento/Framework/App/Language/_files/bar/en_gb/1.csv | 2 +- lib/internal/Magento/Framework/App/Language/Dictionary.php | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_gb/1.csv b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_gb/1.csv index 0c13b51b55287..2083540af9432 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_gb/1.csv +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_gb/1.csv @@ -1,2 +1,2 @@ four and 75/100,4.75 -four and 5/10,4.50 \ No newline at end of file +four and 5/10,4.50 diff --git a/lib/internal/Magento/Framework/App/Language/Dictionary.php b/lib/internal/Magento/Framework/App/Language/Dictionary.php index a8dc20d9465a3..02ee6ca2c9579 100644 --- a/lib/internal/Magento/Framework/App/Language/Dictionary.php +++ b/lib/internal/Magento/Framework/App/Language/Dictionary.php @@ -193,7 +193,9 @@ private function readPackCsv($vendor, $package) foreach ($foundCsvFiles as $foundCsvFile) { $file = $directoryRead->openFile($foundCsvFile); while (($row = $file->readCsv()) !== false) { - $result[$row[0]] = $row[1]; + if (is_array($row) && count($row) > 1) { + $result[$row[0]] = $row[1]; + } } } } From e8fc7b42c89cffdd5a2a549a4db77a2c018b764f Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Sat, 19 May 2018 10:47:34 +0300 Subject: [PATCH 2/2] Update 1.csv Added one more empty line --- .../Magento/Framework/App/Language/_files/bar/en_gb/1.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_gb/1.csv b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_gb/1.csv index 2083540af9432..235d18468b739 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_gb/1.csv +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Language/_files/bar/en_gb/1.csv @@ -1,2 +1,3 @@ four and 75/100,4.75 four and 5/10,4.50 +