-
Notifications
You must be signed in to change notification settings - Fork 79
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
BUGFIX EXTREST-137 simpleXml fix for & in values #109
Conversation
Codecov Report
@@ Coverage Diff @@
## master #109 +/- ##
============================================
+ Coverage 91.59% 91.81% +0.21%
- Complexity 353 354 +1
============================================
Files 81 81
Lines 1035 1038 +3
============================================
+ Hits 948 953 +5
+ Misses 87 85 -2
Continue to review full report at Codecov.
|
70b5a9f
to
9df581f
Compare
src/Api/Client.php
Outdated
@@ -346,7 +346,7 @@ protected function _arrayToXml(array $array, SimpleXMLElement $xml, $parentEl = | |||
if (is_array($value)) { | |||
$this->_arrayToXml($value, $this->_isAssocArray($value) ? $xml->addChild($el) : $xml, $el); | |||
} else { | |||
$xml->addChild($el, $value); | |||
$xml->addChild($el, htmlspecialchars($value)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not $xml->{$el} = $value
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
then we get the problem
It is not yet possible to assign complex types to properties
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, does it work with htmlspecialchars
? It seems to cast string type for any complex type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe $xml->{$el} = (string)$value
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the type of $value in case of the problem?
@@ -114,6 +114,7 @@ private function _get($command, $field, $value) | |||
$filterTag = $getTag->addChild('filter'); | |||
if (!is_null($field)) { | |||
$filterTag->addChild($field, $value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this extra element
src/Api/Operator/Database.php
Outdated
@@ -136,6 +136,7 @@ private function _get($command, $field, $value) | |||
$filterTag = $getTag->addChild('filter'); | |||
if (!is_null($field)) { | |||
$filterTag->addChild($field, $value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this extra element
src/Api/Operator/Site.php
Outdated
@@ -33,7 +33,7 @@ public function create(array $properties) | |||
foreach ($properties[static::PROPERTIES_HOSTING] as $name => $value) { | |||
$propertyNode = $hostingNode->addChild('property'); | |||
$propertyNode->addChild('name', $name); | |||
$propertyNode->addChild('value', $value); | |||
$propertyNode->addChild('value', htmlspecialchars($value)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$propertyNode->name = $name;
$propertyNode->value = $value;
src/Api/Operator/Webspace.php
Outdated
@@ -83,7 +83,7 @@ public function create(array $properties, array $hostingProperties = null, strin | |||
foreach ($hostingProperties as $name => $value) { | |||
$property = $infoHosting->addChild('property'); | |||
$property->addChild('name', $name); | |||
$property->addChild('value', $value); | |||
$property->addChild('value', htmlspecialchars($value)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$property->name = $name;
$property->value = $value;
3631e26
to
443f9fa
Compare
src/Api/Client.php
Outdated
@@ -324,7 +324,7 @@ protected function _expandRequestShortSyntax($request, SimpleXMLElement $xml) | |||
|
|||
foreach ($parts as $part) { | |||
@list($name, $value) = explode('=', $part); | |||
$node = $node->addChild($name, $value); | |||
$node = $node->addChild($name, htmlspecialchars($value)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the value
here is always string (as the result of explode
). you can use $node->{$name} = $value
657e96a
to
a4e30a1
Compare
a4e30a1
to
c3328f4
Compare
813dbaa
to
21ecea0
Compare
No description provided.