Add check for simple category elements.

Fixes #2655
This commit is contained in:
mark_story 2012-03-07 19:52:06 -05:00
parent 17eb0e4f68
commit 3a8c49e319
2 changed files with 32 additions and 1 deletions

View file

@ -436,6 +436,37 @@ class RssHelperTest extends CakeTestCase {
'/item'
);
$this->assertTags($result, $expected);
$item = array(
'title' => 'My title',
'description' => 'My description',
'link' => 'http://www.google.com/',
'category' => array('Category One', 'Category Two')
);
$result = $this->Rss->item(null, $item);
$expected = array(
'<item',
'<title',
'My title',
'/title',
'<description',
'My description',
'/description',
'<link',
'http://www.google.com/',
'/link',
'<category',
'Category One',
'/category',
'<category',
'Category Two',
'/category',
'<guid',
'http://www.google.com/',
'/guid',
'/item'
);
$this->assertTags($result, $expected);
}
/**

View file

@ -212,7 +212,7 @@ class RssHelper extends AppHelper {
if (is_array($val) && !empty($val[0])) {
foreach ($val as $category) {
$attrib = array();
if (isset($category['domain'])) {
if (is_array($category) && isset($category['domain'])) {
$attrib['domain'] = $category['domain'];
unset($category['domain']);
}