From 470c257f7a02e23956a9a82245f02d4d0f22fa20 Mon Sep 17 00:00:00 2001 From: Freek Vandeursen Date: Thu, 16 Nov 2017 11:56:29 +0100 Subject: [PATCH 1/2] Handle empty or incorrect lines in a language CSV --- lib/internal/Magento/Framework/App/Language/Dictionary.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 723452c71eb6da31f6ac8f221f4c587ce855a309 Mon Sep 17 00:00:00 2001 From: Ievgen Shakhsuvarov Date: Fri, 17 Nov 2017 19:11:45 +0100 Subject: [PATCH 2/2] magento/magento2#12304: Handle empty or incorrect lines in language CSV - Updated test data to cover this case --- .../Magento/Framework/App/Language/_files/bar/en_gb/1.csv | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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..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 \ No newline at end of file +four and 5/10,4.50 +