Permalink
Browse files

bug fix

  • Loading branch information...
1 parent 30ee484 commit 245a23f895ca9f61200803db1db912a74872853f Mashape committed Feb 4, 2011
Showing with 5 additions and 3 deletions.
  1. +5 −3 mashape/methods/call/helpers/serializeObject.php
@@ -77,13 +77,13 @@ function serializeObject($result, $instance, $isSimpleResult, $serverKey) {
$fieldValue = $reflectedClass->getMethod($fieldMethod)->invoke($result);
}
- if ($fieldValue == null && $field->isOptional()) {
+ if ($fieldValue === null && $field->isOptional()) {
// Don't serialize the field
continue;
}
$json .= '"' . $fieldName . '":';
- if ($fieldValue == null) {
+ if ($fieldValue === null) {
$json .= JsonUtils::encodeToJson($fieldValue);
} else {
@@ -107,7 +107,9 @@ function serializeObject($result, $instance, $isSimpleResult, $serverKey) {
}
$json .= ",";
}
- $json = JsonUtils::removeLastChar($fields, $json);
+ if (substr($json, strlen($json) - 1, 1) != "{") {
+ $json = JsonUtils::removeLastChar($fields, $json);
+ }
// Close element
$json .= "}";
}

0 comments on commit 245a23f

Please sign in to comment.