Problem/Motivation

When an XML feed returns an empty string, the there will be a fatal error on PHP 8.1:

ValueError: DOMDocument::loadXML(): Argument #1 ($source) [error]
must not be empty in DOMDocument->loadXML() (line 41 of
feeds_xpathparser/FeedsXPathParserXML.inc).#0
feeds_xpathparser/FeedsXPathParserXML.inc(41):

This should be a normal exception, not a fatal error.

Steps to reproduce

Try to import an XML feed that is empty.

Proposed resolution

Check if feed is empty.

Remaining tasks

PR review

CommentFileSizeAuthor
#3 feeds-xml-3421301-3.patch477 bytesklausi
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

klausi created an issue. See original summary.

klausi’s picture

Issue summary: View changes
klausi’s picture

Status: Active » Needs review
StatusFileSize
new477 bytes

Patch.

klausi’s picture

Issue summary: View changes
laryn’s picture

Status: Needs review » Reviewed & tested by the community

LGTM. I pulled this into the Backdrop version (and threw it into an existing test quickly too):

https://github.com/backdrop-contrib/feeds_xpathparser/commit/9de216f0474...

foxy-vikvik’s picture

We need to update the Feeds module with changes from the issue https://www.drupal.org/project/feeds/issues/3563946

foxy-vikvik’s picture

Status: Reviewed & tested by the community » Needs work
foxy-vikvik’s picture

Status: Needs work » Reviewed & tested by the community

foxy-vikvik changed the visibility of the branch 3421301-valueerror-domdocumentloadxml-argument to hidden.