Skip to content

Commit

Permalink
Fix encoding of nested parameters in multipart requests
Browse files Browse the repository at this point in the history
  • Loading branch information
ob-stripe committed Apr 5, 2019
1 parent d14f02d commit 873d129
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ public static function create($params = null, $options = null)
if (is_null($opts->apiBase)) {
$opts->apiBase = Stripe::$apiUploadBase;
}
return static::_create($params, $opts);
// Manually flatten params, otherwise curl's multipart encoder will
// choke on nested arrays.
// TODO: use array_column() once we drop support for PHP 5.4
$flatParams = [];
foreach (\Stripe\Util\Util::flattenParams($params) as $pair) {
$flatParams[$pair[0]] = $pair[1];
}
return static::_create($flatParams, $opts);
}
}

0 comments on commit 873d129

Please sign in to comment.