Skip to content

Commit

Permalink
convertDomElementToArray should handle zero values
Browse files Browse the repository at this point in the history
  • Loading branch information
bendavies authored and fabpot committed Mar 13, 2014
1 parent e8dadd5 commit 34720c9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php
Expand Up @@ -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>'),
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Config/Util/XmlUtils.php
Expand Up @@ -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;
}
Expand Down

0 comments on commit 34720c9

Please sign in to comment.