Skip to content
Permalink
Browse files

convertDomElementToArray should handle zero values

  • Loading branch information...
bendavies authored and fabpot committed Mar 11, 2014
1 parent e8dadd5 commit 34720c921eacd2a94dd47b3a516426aa059ead47
@@ -80,6 +80,7 @@ public function getDataForConvertDomToArray()
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 @@ public static function convertDomElementToArray(\DomElement $element, $checkPref
$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;
}

0 comments on commit 34720c9

Please sign in to comment.
You can’t perform that action at this time.