did additional checking before attempting to process non-audio items as array

This commit is contained in:
Robbt 2019-02-07 23:33:48 -05:00
parent 55bc9d3a46
commit d8eeb9a0f9
1 changed files with 15 additions and 7 deletions

View File

@ -410,7 +410,11 @@ class Application_Service_PodcastEpisodeService extends Application_Service_Thir
// this is a rather hackish way of accessing the enclosures but get_enclosures() didnt detect multiple
// enclosures at certain points so we search through them and then manually create an enclosure object
// if we find an audio file in an enclosure and send it off
Logging::info('found a non audio');
$testenclosures = $enclosures = $item->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'enclosure');
Logging::info($testenclosures);
// we need to check if this is an array otherwise sizeof will fail and stop this whole script
if (is_array($testenclosures)) {
$numenclosures = sizeof($testenclosures);
for ($i = 0; $i < $numenclosures; $i++) {
$enclosure_attribs = array_values($testenclosures[$i]['attribs'])[0];
@ -420,6 +424,10 @@ class Application_Service_PodcastEpisodeService extends Application_Service_Thir
break;
}
}
}
else {
continue;
}
} else {
$enclosure = $item->get_enclosure();
}