Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ private function is_podcast_feed( $file ) {
return true;
}

$feed_dom = $this->safely_load_xml( $file->body );
$feed_dom = $this->safely_load_xml( (string) $file->body );

// Do this as either/or but prioritise the itunes namespace. It's pretty likely
// that it's a podcast feed we've found if that namespace is present.
Expand All @@ -48,9 +48,13 @@ private function is_podcast_feed( $file ) {
* Safely loads an XML file
*
* @param string $xml A string of XML to load.
* @return DOMDocument|false A restulting DOM document or `false` if there is an error.
* @return DOMDocument|false A resulting DOM document or `false` if there is an error.
*/
private function safely_load_xml( $xml ) {
if ( empty( $xml ) ) {
return false;
}

$disable_entity_loader = PHP_VERSION_ID < 80000;

if ( $disable_entity_loader ) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: other

Podcast feed: Prevent fatals when content is empty.
Loading