Skip to content

Commit

Permalink
Fixed XmlRpc returning encoded string when no type is specified (#7)
Browse files Browse the repository at this point in the history
Fixed XmlRpc returning encoded string when no type is specified
  • Loading branch information
jack-worman authored Mar 14, 2022
1 parent 8f1a017 commit 8466dc0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
3 changes: 0 additions & 3 deletions packages/zend-xmlrpc/library/Zend/XmlRpc/Value.php
Original file line number Diff line number Diff line change
Expand Up @@ -512,9 +512,6 @@ protected static function _extractTypeAndValue(SimpleXMLElement $xml, &$type, &$
// If no type was specified, the default is string
if (!$type) {
$type = self::XMLRPC_TYPE_STRING;
if (preg_match('#^<value>.*</value>$#', $xml->asXML())) {
$value = str_replace(array('<value>', '</value>'), '', $xml->asXML());
}
}
}

Expand Down
21 changes: 16 additions & 5 deletions tests/Zend/XmlRpc/ValueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,22 @@ public function testMarshalStringFromNative()

public function testFactoryAutodetectsStringAndSetsValueInArray()
{
$val = Zend_XmlRpc_Value::getXmlRpcValue('<value><array><data>'.
'<value><i4>8</i4></value>'.
'<value>a</value>'.
'<value>false</value>'.
'</data></array></value>', Zend_XmlRpc_Value::XML_STRING
$val = Zend_XmlRpc_Value::getXmlRpcValue(
<<<'XML'
<value>
<array>
<data>
<value>
<i4>8</i4>
</value>
<value>a</value>
<value>false</value>
</data>
</array>
</value>
XML
,
Zend_XmlRpc_Value::XML_STRING
);
$this->assertXmlRpcType('array', $val);
$a = $val->getValue();
Expand Down

0 comments on commit 8466dc0

Please sign in to comment.