From fce467293748fe6063b6c42ad68e63aa4bfe3d65 Mon Sep 17 00:00:00 2001 From: magento-engcom-team Date: Thu, 26 Oct 2017 13:53:18 +0300 Subject: [PATCH] [2.3-develop] X-Magento-Tags header containing whitespaces causes exception (cherry picked from commit 026da5a) --- .../Framework/Config/Converter/Dom/Flat.php | 4 ++-- .../Unit/_files/converter/dom/flat/result.php | 7 +++++++ .../Unit/_files/converter/dom/flat/source.xml | 19 +++++++++++++++++++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/lib/internal/Magento/Framework/Config/Converter/Dom/Flat.php b/lib/internal/Magento/Framework/Config/Converter/Dom/Flat.php index 67b8937442310..7f64705a6bde0 100644 --- a/lib/internal/Magento/Framework/Config/Converter/Dom/Flat.php +++ b/lib/internal/Magento/Framework/Config/Converter/Dom/Flat.php @@ -102,9 +102,9 @@ public function convert(\DOMNode $source, $basePath = '') } } else { if ($result) { - $result['value'] = $value; + $result['value'] = trim($value); } else { - $result = $value; + $result = trim($value); } } return $result; diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/converter/dom/flat/result.php b/lib/internal/Magento/Framework/Config/Test/Unit/_files/converter/dom/flat/result.php index c724d6ef43b5b..c9894c96c20e4 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/converter/dom/flat/result.php +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/converter/dom/flat/result.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +// @codingStandardsIgnoreFile return [ 'root' => [ 'node_one' => [ @@ -11,14 +12,20 @@ 'subnode' => [ ['attributeThree' => '30'], ['attributeThree' => '40', 'attributeFour' => '40', 'value' => 'Value1'], + ['attributeThree' => '50', 'value' => 'value_from_new_line'], + ['attributeThree' => '60', 'value' => 'auto_formatted_by_ide_value_due_to_line_size_restriction'] ], 'books' => ['attributeFive' => '50'], ], 'multipleNode' => [ 'one' => ['id' => 'one', 'name' => 'name1', 'value' => '1'], 'two' => ['id' => 'two', 'name' => 'name2', 'value' => '2'], + 'three' => ['id' => 'three', 'name' => 'name3', 'value' => 'value_from_new_line'], + 'four' => ['id' => 'four', 'name' => 'name4', 'value' => 'auto_formatted_by_ide_value_due_to_line_size_restriction'], ], 'someOtherVal' => '', 'someDataVal' => '', + 'valueFromNewLine' => 'value_from_new_line', + 'autoFormattedValue' => 'auto_formatted_by_ide_value_due_to_line_size_restriction' ] ]; diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/_files/converter/dom/flat/source.xml b/lib/internal/Magento/Framework/Config/Test/Unit/_files/converter/dom/flat/source.xml index e6b16b8552dd8..5071bdd286e64 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/_files/converter/dom/flat/source.xml +++ b/lib/internal/Magento/Framework/Config/Test/Unit/_files/converter/dom/flat/source.xml @@ -9,6 +9,11 @@ Value1 + + value_from_new_line + + auto_formatted_by_ide_value_due_to_line_size_restriction + @@ -19,4 +24,18 @@ + + + value_from_new_line + + + + auto_formatted_by_ide_value_due_to_line_size_restriction + + + + value_from_new_line + + auto_formatted_by_ide_value_due_to_line_size_restriction +