Skip to content
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

Merged
merged 1 commit into from
Oct 6, 2021

Conversation

vdiomidov
Copy link

No description provided.

@vdiomidov vdiomidov requested a review from xgin October 5, 2021 11:13
@codecov-commenter
Copy link

codecov-commenter commented Oct 5, 2021

Codecov Report

Merging #109 (21ecea0) into master (8ad7345) will increase coverage by 0.21%.
The diff coverage is 90.62%.

Impacted file tree graph

@@             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     
Impacted Files Coverage Δ
src/Api/Operator/Site.php 0.00% <0.00%> (ø)
src/Api/Client.php 86.85% <100.00%> (+0.22%) ⬆️
src/Api/Operator.php 91.89% <100.00%> (ø)
src/Api/Operator/Certificate.php 100.00% <100.00%> (ø)
src/Api/Operator/Customer.php 85.71% <100.00%> (ø)
src/Api/Operator/Database.php 100.00% <100.00%> (+4.34%) ⬆️
src/Api/Operator/DatabaseServer.php 100.00% <100.00%> (ø)
src/Api/Operator/Dns.php 100.00% <100.00%> (ø)
src/Api/Operator/DnsTemplate.php 100.00% <100.00%> (ø)
src/Api/Operator/Mail.php 100.00% <100.00%> (ø)
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8ad7345...21ecea0. Read the comment docs.

@vdiomidov vdiomidov force-pushed the bugfix-vdiomidov-simplexml-amprsant-fix-ppp-54497 branch 3 times, most recently from 70b5a9f to 9df581f Compare October 5, 2021 12:47
@@ -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));
Copy link
Member

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?

Copy link
Author

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

Copy link
Member

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.

Copy link
Member

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?

Copy link
Member

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?

src/Api/Operator/Mail.php Outdated Show resolved Hide resolved
@@ -114,6 +114,7 @@ private function _get($command, $field, $value)
$filterTag = $getTag->addChild('filter');
if (!is_null($field)) {
$filterTag->addChild($field, $value);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this extra element

@@ -136,6 +136,7 @@ private function _get($command, $field, $value)
$filterTag = $getTag->addChild('filter');
if (!is_null($field)) {
$filterTag->addChild($field, $value);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this extra element

@@ -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));
Copy link
Member

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;

@@ -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));
Copy link
Member

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;

@vdiomidov vdiomidov force-pushed the bugfix-vdiomidov-simplexml-amprsant-fix-ppp-54497 branch 2 times, most recently from 3631e26 to 443f9fa Compare October 5, 2021 17:11
@@ -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));
Copy link
Member

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

@vdiomidov vdiomidov force-pushed the bugfix-vdiomidov-simplexml-amprsant-fix-ppp-54497 branch from 657e96a to a4e30a1 Compare October 6, 2021 10:02
@vdiomidov vdiomidov changed the title BUGFIX PPP-54497 simpleXml fix for & in values BUGFIX EXTREST-137 simpleXml fix for & in values Oct 6, 2021
@vdiomidov vdiomidov force-pushed the bugfix-vdiomidov-simplexml-amprsant-fix-ppp-54497 branch from a4e30a1 to c3328f4 Compare October 6, 2021 10:05
@vdiomidov vdiomidov force-pushed the bugfix-vdiomidov-simplexml-amprsant-fix-ppp-54497 branch from 813dbaa to 21ecea0 Compare October 6, 2021 10:08
@xgin xgin merged commit f226ce3 into master Oct 6, 2021
@xgin xgin deleted the bugfix-vdiomidov-simplexml-amprsant-fix-ppp-54497 branch October 6, 2021 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants