Skip to content

Commit 657e96a

Browse files
author
viacheslav diomidov
committed
BUGFIX PPP-54497 simpleXml fix for & in values
1 parent 443f9fa commit 657e96a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/Api/Client.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,10 +321,15 @@ protected function _expandRequestShortSyntax($request, SimpleXMLElement $xml)
321321
{
322322
$parts = explode('.', $request);
323323
$node = $xml;
324+
$lastParts = end($parts);
324325

325326
foreach ($parts as $part) {
326327
@list($name, $value) = explode('=', $part);
327-
$node = $node->addChild($name, htmlspecialchars($value));
328+
if($part !== $lastParts) {
329+
$node = $node->addChild($name);
330+
} else {
331+
$node->{$name} = (string)$value;
332+
}
328333
}
329334

330335
return $xml->asXML();
@@ -346,7 +351,7 @@ protected function _arrayToXml(array $array, SimpleXMLElement $xml, $parentEl =
346351
if (is_array($value)) {
347352
$this->_arrayToXml($value, $this->_isAssocArray($value) ? $xml->addChild($el) : $xml, $el);
348353
} else {
349-
$xml->addChild($el, htmlspecialchars($value));
354+
$xml->{$el} = (string)$value;
350355
}
351356
}
352357

0 commit comments

Comments
 (0)