strangerstudios / pmpro-infusionsoft

Integrate Infusionsoft with Paid Memberships Pro. Members are tagged according to settings.
https://www.paidmembershipspro.com/add-ons/pmpro-infusionsoft-integration/
5 stars 10 forks source link

Error in XML Parser #11

Open ideadude opened 4 years ago

ideadude commented 4 years ago

A user has shared that they get this error when using the plugin:

Using Infusionsoft Addon and a discount code that sets a subscription to FREE. Getting an error in the pmpro-infusionsoft/includes/xmlrpc.inc line 2608. Error is saying that count() can’t be performed because object is not an array. I believe it’s because $data is blank since it’s a free subscription now. As such, there is no returned $data. I managed to put an “if” statement in before this to check if $data is an array and if not skip this step but uncertain if that is the right thing to do.

Tracked down to this line: https://github.com/strangerstudios/pmpro-infusionsoft/blob/17c5de882bd8fba4a8ed3209bcfd073cd4f96b33/includes/xmlrpc.inc#L2608

This seems to be using the xml_parse function incorrectly. See php docs https://www.php.net/manual/en/function.xml-parse.php

The 3rd param there per the docs:

is_final - If set and TRUE, data is the last piece of data sent in this parse.

The script is passing count($data) as the third parameter.

The issue the user was actually getting though was happening when data was empty, so we should check that as well there.

Have to be careful in noting things when tweaking an included library.