At RSS20.inc:

if ((string)$news['category'] && !empty($news['category']))

It's wrong, because the &&.
Correct code:

if ((string)$news['category'] || !empty($news['category'])) {

Only this way the $additional_taxonomies['RSS Categories'] won't be empty.

Comments

vito_swat’s picture

Well, I don't think we should check !empty($news['category']) at all. If $news['category'] casted to string gives us empty string it's simply empty or there was no category tag in this item. Checking if $news['category'] is not empty is simply redundant.

BTW If additional_taxonomies is an array we should collect all terms (like in RDF handler) and not simply top one so instead of:

if ((string)$news['category'] && !empty($news['category']))
		{
			if (is_array($news['category'])) $news['category'] = $news['category'][0];
			$additional_taxonomies['RSS Categories'] = explode('/', $news['category']);
		}

there should be:

			if ((string)$news['category'])
			{
				//there can be multiple category tags
				if (is_array($news['category']))
				{
					foreach ($news['category'] as $cat)
					{
						if (is_object($cat))  //don't know if it's the case in RSS that categories have tags in them
							$additional_taxonomies['RSS Categories'][] = trim(strip_tags($cat->asXML()));
						else
							$additional_taxonomies['RSS Categories'][] = $cat;
					}
				}
				else //or single tag
					$additional_taxonomies['RSS Categories'] = explode($category_splitter, (string)$news['category']);
			}
vito_swat’s picture

Status: Active » Needs review

I forgot to change status

vito_swat’s picture

Version: 5.x-3.1 » 5.x-4.0
Status: Needs review » Fixed

Similar code committed in 5.x-4.0

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.