Closed jar-stripe closed 1 month ago
The indented comments were automatic and I couldn't figure out how to get VS code to knock it off.
added a test for empty array to convertToStripeObject (in Util) so that this case falls thru the is_array branch and returns an empty StripeObject object
is the test supposed to be in this PR?
added a test for empty array to convertToStripeObject (in Util) so that this case falls thru the is_array branch and returns an empty StripeObject object
is the test supposed to be in this PR?
sorry, poor choice of words. by test i meant a conditional test, as part of an if statement.
The fixes here were implemented better in https://github.com/stripe/stripe-php/pull/1755 and https://github.com/stripe/stripe-php/pull/1754
Why?
When testing the meter event stream examples, I saw error code 400 return from creating a MeterEventSession (using MeterEventSessionService.create()) the issue was that we were sending an encoded empty array [] instead of no body. The fix here is to allow null params through, and then test for null where we attempt to iterate thru them.
After fixing this, I saw that creating a MeterEventStream (using MeterEventSessionService) was raising an exception when trying to setLastResponse. The issue here is that the response from the server is empty, which json_decode decodes as an empty array, which is then interpreted as a list in
convertToStripeObject
. The fix here (I think) is to not interpret an empty array as a list.What?