Skip to content

fix(Webapi Xml Renderer - 18361): removed the not needed ampersand re… #18380

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
*/
namespace Magento\Framework\Webapi\Rest\Response\Renderer;

/**
* Renders response data in Xml format.
*/
class Xml implements \Magento\Framework\Webapi\Rest\Response\RendererInterface
{
/**
Expand Down Expand Up @@ -111,8 +114,7 @@ protected function _formatValue($value)
/** Without the following transformation boolean values are rendered incorrectly */
$value = $value ? 'true' : 'false';
}
$replacementMap = ['&' => '&'];
return str_replace(array_keys($replacementMap), array_values($replacementMap), $value);
return (string) $value;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ public function providerXmlRender()
'<?xml version="1.0"?><response><item_7key>value</item_7key></response>',
'Invalid XML render with numeric symbol in data index.'
],
[
['key' => 'test & foo'],
'<?xml version="1.0"?><response><key>test &amp; foo</key></response>',
'Invalid XML render with ampersand symbol in data index.'
],
[
['.key' => 'value'],
'<?xml version="1.0"?><response><item_key>value</item_key></response>',
Expand Down