Skip to content

Commit 0f75306

Browse files
committed
fix(Webapi Xml Renderer - 18361): added unit test for the issue
1 parent ecd9dc4 commit 0f75306

File tree

2 files changed

+6
-1
lines changed
  • lib/internal/Magento/Framework/Webapi

2 files changed

+6
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ protected function _formatValue($value)
111111
/** Without the following transformation boolean values are rendered incorrectly */
112112
$value = $value ? 'true' : 'false';
113113
}
114-
return $value;
114+
return (string) $value;
115115
}
116116

117117
/**

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)