convertDomElementToArray should handle zero values
This commit is contained in:
parent
e8dadd5398
commit
34720c921e
@ -80,6 +80,7 @@ class XmlUtilsTest extends \PHPUnit_Framework_TestCase
|
||||
array(array('foo' => null), '<foo />'),
|
||||
array(array('foo' => 'bar'), '<foo>bar</foo>'),
|
||||
array(array('foo' => array('foo' => 'bar')), '<foo foo="bar"/>'),
|
||||
array(array('foo' => array('foo' => 0)), '<foo><foo>0</foo></foo>'),
|
||||
array(array('foo' => array('foo' => 'bar')), '<foo><foo>bar</foo></foo>'),
|
||||
array(array('foo' => array('foo' => 'bar', 'value' => 'text')), '<foo foo="bar">text</foo>'),
|
||||
array(array('foo' => array('attr' => 'bar', 'foo' => 'text')), '<foo attr="bar"><foo>text</foo></foo>'),
|
||||
|
@ -132,7 +132,7 @@ class XmlUtils
|
||||
$nodeValue = false;
|
||||
foreach ($element->childNodes as $node) {
|
||||
if ($node instanceof \DOMText) {
|
||||
if (trim($node->nodeValue)) {
|
||||
if (strlen(trim($node->nodeValue)) > 0) {
|
||||
$nodeValue = trim($node->nodeValue);
|
||||
$empty = false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user