Skip to content

fix improper use of array in StripeIPN

JonGold requested to merge JonGold/stripe:ipn-array into master

To fix missing data from before the mjwshared 1.2.17 fix, I tried Stripe.ipn and Stripe.retryall APIs. Both gave me an error that I can't access on object as an array.

At first I thought there were two code paths to Civi\Stripe\Webhook\Events::setData(), one that provides an array, the other an object. But lines like:

if (($this->getData()->object['object'] ?? '') !== 'invoice') {

are immediately followed by lines like:

$invoiceID = $this->api->getValueFromStripeObject('invoice_id', 'String', $this->getData()->object);

One requires $this->getData()->object to be an array, the other an object, so they both can't be right.

This standardizes all usages of $this->getData()->object to treat it as an object.

Merge request reports