intuit / QuickBooks-V3-PHP-SDK

Official PHP SDK for QuickBooks REST API v3.0: https://developer.intuit.com/
Apache License 2.0
246 stars 246 forks source link

Illegal characters inside response will cause fatal error in XmlObjectSerializer.php #288

Open siimtalts opened 4 years ago

siimtalts commented 4 years ago

When fetching a payments via API the response has illegal characters:

<creditcardpayment>
    <creditchargeinfo>
        <number>xxxxxxxxxxxx8005</number>
        <nameonacct>Lets Panic</nameonacct>
        <ccexpirymonth>12</ccexpirymonth>
        <ccexpiryyear>2017</ccexpiryyear>
        <postalcode>9999</postalcode>
    </creditchargeinfo>
</creditcardpayment>

Notice the weird symbol in nameonacct. This is illegal characer and results in an fatal error thrown by simplexml_load_string in XmlObjectSerializer. I know this is because legacy data, as I wasn't able to reproduce this with new entries in QB, but it needs to be fixed, because we are dealing with importing older datasets with this SDK.

Solution: implement XML sanitization. An example code snippet can be found from here: https://www.ryadel.com/en/php-skip-invalid-characters-utf-8-xml-file-string/

bsivalingam commented 4 years ago

@siimtalts Please send in a PR if you are interested to fix it, I will have it reviewed and merged.

abisalehalliprasan commented 4 years ago

Opening up SDK for hacktoberfest contributions.

Hacktoberfest is underway right now and we would love for you to contribute 🚀 . More information on #hacktoberfest is here

Develop-with-Intuit for Hacktoberfest

rum1887 commented 1 year ago

is the issue open?