Skip to content

Commit 65b745f

Browse files
Merge forwardport of #12133 to 2.3-develop branch
Applied pull request patch https://github.com/magento/magento2/pull/12133.patch (created by @erfanimani) based on commit(s): 1. cfab448 Fixed GitHub Issues in 2.3-develop branch: - #12127: Apostrophe in attribute option value in admin is not handled properly (reported by @erfanimani)
2 parents b55a5d1 + 92f8586 commit 65b745f

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

Diff for: app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/options.phtml

+3-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,9 @@ $stores = $block->getStoresSortedBySortOrder();
8888
$values = [];
8989
foreach($block->getOptionValues() as $value) {
9090
$value = $value->getData();
91-
$values[] = is_array($value) ? array_map("htmlspecialchars_decode", $value) : $value;
91+
$values[] = is_array($value) ? array_map(function($str) {
92+
return htmlspecialchars_decode($str, ENT_QUOTES);
93+
}, $value) : $value;
9294
}
9395
?>
9496
<script type="text/x-magento-init">

Diff for: dev/tests/functional/tests/app/Magento/Catalog/Test/Repository/CatalogProductAttribute/Options.xml

+7
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,12 @@
2222
<item name="admin" xsi:type="string">white</item>
2323
</field>
2424
</dataset>
25+
26+
<dataset name="option_with_single_quotation">
27+
<field name="0" xsi:type="array">
28+
<item name="is_default" xsi:type="string">Yes</item>
29+
<item name="admin" xsi:type="string">test option with single\&apos;</item>
30+
</field>
31+
</dataset>
2532
</repository>
2633
</config>

Diff for: dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/ProductAttribute/CreateProductAttributeEntityTest.xml

+11
Original file line numberDiff line numberDiff line change
@@ -208,5 +208,16 @@
208208
<data name="productAttribute/data/is_comparable" xsi:type="string">Yes</data>
209209
<constraint name="Magento\Catalog\Test\Constraint\AssertProductAttributeIsUnique" />
210210
</variation>
211+
<variation name="CreateProductAttributeEntityTestVariation10" summary="Create custom dropdown attribute with single quotation in option">
212+
<data name="attributeSet/dataset" xsi:type="string">custom_attribute_set</data>
213+
<data name="productAttribute/data/frontend_label" xsi:type="string">Dropdown_Admin_%isolation%</data>
214+
<data name="productAttribute/data/frontend_input" xsi:type="string">Dropdown</data>
215+
<data name="productAttribute/data/options/dataset" xsi:type="string">option_with_single_quotation</data>
216+
<data name="productAttribute/data/is_required" xsi:type="string">Yes</data>
217+
<data name="productAttribute/data/attribute_code" xsi:type="string">attr_dropdown_%isolation%</data>
218+
<data name="productAttribute/data/is_global" xsi:type="string">Global</data>
219+
<data name="productAttribute/data/is_unique" xsi:type="string">No</data>
220+
<constraint name="Magento\Catalog\Test\Constraint\AssertAttributeForm" />
221+
</variation>
211222
</testCase>
212223
</config>

0 commit comments

Comments
 (0)