Permalink
Browse files

Properly encode true / false

  • Loading branch information...
1 parent 43f06f3 commit a6b6149d996d1f300b7ca62e11ec476b99887113 @gdb gdb committed Jul 13, 2011
Showing with 8 additions and 4 deletions.
  1. +8 −4 lib/Stripe/ApiRequestor.php
@@ -23,14 +23,18 @@ public static function utf8($value)
return $value;
}
- private static function _objectsToIds($d)
+ private static function _encodeObjects($d)
{
if ($d instanceof Stripe_ApiRequestor) {
return $d->id;
+ } else if ($d === true) {
+ return 'true';
+ } else if ($d === false) {
+ return 'false';
} else if (is_array($d)) {
$res = array();
- foreach ($res as $k => $v)
- $res[$k] = self::_objectsToIds($v);
+ foreach ($d as $k => $v)
+ $res[$k] = self::_encodeObjects($v);
return $res;
} else {
return $d;
@@ -82,7 +86,7 @@ private function _requestRaw($meth, $url, $params)
$absUrl = $this->apiUrl($url);
$params = Stripe_Util::arrayClone($params);
- self::_objectsToIds($params);
+ $params = self::_encodeObjects($params);
$langVersion = phpversion();
$uname = php_uname();
$ua = array('bindings_version' => Stripe::VERSION,

0 comments on commit a6b6149

Please sign in to comment.