From 34720c921eacd2a94dd47b3a516426aa059ead47 Mon Sep 17 00:00:00 2001 From: Ben Davies Date: Tue, 11 Mar 2014 17:36:00 +0000 Subject: [PATCH] convertDomElementToArray should handle zero values --- src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php | 1 + src/Symfony/Component/Config/Util/XmlUtils.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php b/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php index feb796b68f..722c4db144 100644 --- a/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php +++ b/src/Symfony/Component/Config/Tests/Util/XmlUtilsTest.php @@ -80,6 +80,7 @@ class XmlUtilsTest extends \PHPUnit_Framework_TestCase array(array('foo' => null), ''), array(array('foo' => 'bar'), 'bar'), array(array('foo' => array('foo' => 'bar')), ''), + array(array('foo' => array('foo' => 0)), '0'), array(array('foo' => array('foo' => 'bar')), 'bar'), array(array('foo' => array('foo' => 'bar', 'value' => 'text')), 'text'), array(array('foo' => array('attr' => 'bar', 'foo' => 'text')), 'text'), diff --git a/src/Symfony/Component/Config/Util/XmlUtils.php b/src/Symfony/Component/Config/Util/XmlUtils.php index f2ea98beed..494d7c3895 100644 --- a/src/Symfony/Component/Config/Util/XmlUtils.php +++ b/src/Symfony/Component/Config/Util/XmlUtils.php @@ -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; }