Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixing XmlHelper::elem() when value is null and cdata = true. Removin…

…g empty invalid tag.

Test cases added.
Fixes #127
  • Loading branch information...
commit 06cf97459a5fbe82f66d191bf4ce192866bab548 1 parent e030400
@markstory markstory authored
View
2  cake/libs/view/helpers/xml.php
@@ -112,7 +112,7 @@ function elem($name, $attrib = array(), $content = null, $endTag = true) {
$cdata = true;
unset($content['cdata']);
}
- if (is_array($content) && isset($content['value'])) {
+ if (is_array($content) && array_key_exists('value', $content)) {
$content = $content['value'];
}
$children = array();
View
4 cake/tests/cases/libs/view/helpers/xml.test.php
@@ -131,6 +131,10 @@ function testRenderZeroElement() {
$result = $this->Xml->elem('count', null, 0);
$expected = '<count>0</count>';
$this->assertEqual($result, $expected);
+
+ $result = $this->Xml->elem('count', null, array('cdata' => true, 'value' => null));
+ $expected = '<count />';
+ $this->assertEqual($result, $expected);
}
/**
* testRenderElementWithNamespace method
Please sign in to comment.
Something went wrong with that request. Please try again.