Skip to content

Commit b4181a0

Browse files
committed
fix(Webapi Xml Renderer - 18361): removed the not needed ampersand replacement, covered by tests
1 parent da5a9ed commit b4181a0

File tree

2 files changed

+7
-2
lines changed
  • lib/internal/Magento/Framework/Webapi

2 files changed

+7
-2
lines changed

lib/internal/Magento/Framework/Webapi/Rest/Response/Renderer/Xml.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,7 @@ protected function _formatValue($value)
111111
/** Without the following transformation boolean values are rendered incorrectly */
112112
$value = $value ? 'true' : 'false';
113113
}
114-
$replacementMap = ['&' => '&'];
115-
return str_replace(array_keys($replacementMap), array_values($replacementMap), $value);
114+
return (string) $value;
116115
}
117116

118117
/**
@@ -166,3 +165,4 @@ protected function _prepareKey($key)
166165
return $key;
167166
}
168167
}
168+

lib/internal/Magento/Framework/Webapi/Test/Unit/Rest/Response/Renderer/XmlTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ public function providerXmlRender()
7676
'<?xml version="1.0"?><response><item_7key>value</item_7key></response>',
7777
'Invalid XML render with numeric symbol in data index.'
7878
],
79+
[
80+
['key' => 'test & foo'],
81+
'<?xml version="1.0"?><response><key>test &amp; foo</key></response>',
82+
'Invalid XML render with ampersand symbol in data index.'
83+
],
7984
[
8085
['.key' => 'value'],
8186
'<?xml version="1.0"?><response><item_key>value</item_key></response>',

0 commit comments

Comments
 (0)