diff --git a/CHANGELOG b/CHANGELOG index 782403a..affd47c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -3,6 +3,9 @@ codebird-php - changelog 2.5.0 (not yet released) +2.4.1 (not yet released) ++ #26 Stringify null and boolean parameters + 2.4.0 (2013-06-15) + Add contributing guidelines + rfe #21 JSON return format diff --git a/src/codebird.php b/src/codebird.php index 47e97dc..e7d9987 100644 --- a/src/codebird.php +++ b/src/codebird.php @@ -217,6 +217,19 @@ public function __call($fn, $params) } } } + + // stringify null and boolean parameters + foreach ($apiparams as $key => $value) { + if (! is_scalar($value)) { + continue; + } + if (is_null($value)) { + $apiparams[$key] = 'null'; + } elseif (is_bool($value)) { + $apiparams[$key] = $value ? 'true' : 'false'; + } + } + $app_only_auth = false; if (count($params) > 1) { $app_only_auth = !! $params[1];