Skip to content

Commit

Permalink
Merge pull request #749 from InteractionDesignFoundation/fixed-toArray
Browse files Browse the repository at this point in the history
Call `toArray()` on objects only
  • Loading branch information
ob-stripe authored Sep 26, 2019
2 parents 9a58f03 + 931bf08 commit e57cd77
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/StripeObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ public function toArray()
return null;
}

return method_exists($value, 'toArray') ? $value->toArray() : $value;
return is_object($value) && method_exists($value, 'toArray') ? $value->toArray() : $value;
};

return array_reduce(array_keys($this->_values), function ($acc, $k) use ($maybeToArray) {
Expand Down

0 comments on commit e57cd77

Please sign in to comment.