mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
commit
99af4bba83
2 changed files with 19 additions and 1 deletions
|
@ -395,7 +395,15 @@ XML;
|
|||
$obj = Xml::fromArray($xml, 'attributes');
|
||||
$xmlText = '<' . '?xml version="1.0" encoding="UTF-8"?><tags><tag id="1">defect</tag></tags>';
|
||||
$this->assertXmlStringEqualsXmlString($xmlText, $obj->asXML());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test fromArray() with zero values.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testFromArrayZeroValue()
|
||||
{
|
||||
$xml = array(
|
||||
'tag' => array(
|
||||
'@' => 0,
|
||||
|
@ -406,6 +414,16 @@ XML;
|
|||
$xmlText = <<<XML
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<tag test="A test">0</tag>
|
||||
XML;
|
||||
$this->assertXmlStringEqualsXmlString($xmlText, $obj->asXML());
|
||||
|
||||
$xml = array(
|
||||
'tag' => array('0')
|
||||
);
|
||||
$obj = Xml::fromArray($xml);
|
||||
$xmlText = <<<XML
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<tag>0</tag>
|
||||
XML;
|
||||
$this->assertXmlStringEqualsXmlString($xmlText, $obj->asXML());
|
||||
}
|
||||
|
|
|
@ -312,7 +312,7 @@ class Xml {
|
|||
$childNS = $value['xmlns:'];
|
||||
unset($value['xmlns:']);
|
||||
}
|
||||
} elseif (!empty($value) || $value === 0) {
|
||||
} elseif (!empty($value) || $value === 0 || $value === '0') {
|
||||
$childValue = (string)$value;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue