mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fix a problem of tag values which is not taken into account
(when equal to zero) when passing an XML object to an array.
This commit is contained in:
parent
d01d291d13
commit
ca6612bc8b
2 changed files with 11 additions and 1 deletions
|
@ -644,6 +644,16 @@ XML;
|
|||
)
|
||||
);
|
||||
$this->assertEquals($expected, Xml::toArray($obj));
|
||||
|
||||
$xml = '<tag type="myType">0</tag>';
|
||||
$obj = Xml::build($xml);
|
||||
$expected = array(
|
||||
'tag' => array(
|
||||
'@type' => 'myType',
|
||||
'@' => 0
|
||||
)
|
||||
);
|
||||
$this->assertEquals($expected, Xml::toArray($obj));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -360,7 +360,7 @@ class Xml {
|
|||
$asString = trim((string)$xml);
|
||||
if (empty($data)) {
|
||||
$data = $asString;
|
||||
} elseif (!empty($asString)) {
|
||||
} elseif (strlen($asString) > 0) {
|
||||
$data['@'] = $asString;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue