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

Null array value regression #525

Closed
EatonZ opened this issue Sep 24, 2018 · 2 comments · Fixed by #526
Closed

Null array value regression #525

EatonZ opened this issue Sep 24, 2018 · 2 comments · Fixed by #526
Assignees

Comments

@EatonZ
Copy link

EatonZ commented Sep 24, 2018

Hi, we updated the Stripe PHP library on our server the other day to 6.17.2 and our order process has started failing. After looking into it, it appears the problem may be with the Stripe PHP library.

Our code:

$customer_id = \Stripe\Customer::create(array(
  'email' => $email_address,
  'metadata' => $wp_user_id == 0 ? array() : array('wp_user_id' => $wp_user_id),
  'source' => $source
))->id;

The catch here is that source may be null. This was done to make passing a source optional. In previous Stripe PHP versions, setting an array value to null meant it would not be sent at all. It appears the behavior has recently changed to instead interpret null as an empty string, so our order process has blown up with this Stripe error response: Invalid source object: must be a dictionary or a non-empty string.

I looked in our Stripe dashboard and see there is a source in the request body as an empty string, which should not be there.

Update: The version we were on before that worked fine was 6.17.0. I think the array changes you made in 6.17.1 and 6.17.2 are the culprit here.

@ob-stripe
Copy link
Contributor

Hi @EatonZ, thanks for the detailed report. I've confirmed the regression and will push a fix shortly. Sorry for the inconvenience!

@ob-stripe
Copy link
Contributor

This should be fixed in 6.19.1.

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 a pull request may close this issue.

2 participants