Skip to content

Prevent fatal error when QuickBooks Online returns incomplete XML#316

Open
emilebourquin wants to merge 1 commit intoconsolibyte:masterfrom
emilebourquin:master
Open

Prevent fatal error when QuickBooks Online returns incomplete XML#316
emilebourquin wants to merge 1 commit intoconsolibyte:masterfrom
emilebourquin:master

Conversation

@emilebourquin
Copy link
Copy Markdown
Contributor

@emilebourquin emilebourquin commented Sep 26, 2022

This diff looks much bloodier than it is. All I did was wrap the call to $List = $Root->getChildAt('IntuitResponse QueryResponse') in an IF, and return false in the ELSE.

Prevents a fatal error when QuickBooks Online returns incomplete XML, and the call to $List = $Root->getChildAt('IntuitResponse QueryResponse') returns FALSE, so $List->attributes() throws an error.

Prevents a fatal error when QuickBooks Online is offline, and the call to $List = $Root->getChildAt('IntuitResponse QueryResponse') returns FALSE, so $List->attributes() throws an error.
@emilebourquin
Copy link
Copy Markdown
Contributor Author

emilebourquin commented Sep 26, 2022

I guess I shouldn't say QuickBooks Online was offline, but rather QuickBooks Online was returning XML such that
$Doc = $Parser->parse($errnum, $errmsg)
and
$Root = $Doc->getRoot();
were succeeding, but
$List = $Root->getChildAt('IntuitResponse QueryResponse')
was false, and
$attrs = $List->attributes();
caused a fatal error.

@emilebourquin emilebourquin changed the title Prevent fatal error when QuickBooks Online is offline Prevent fatal error when QuickBooks Online returns incomplete XML Sep 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants