Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent fatal error when QuickBooks Online returns incomplete XML #316

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

emilebourquin
Copy link
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
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