Fixed Bug in PPModel when empty json string is returned

This commit is contained in:
japatel
2014-11-06 00:10:09 -06:00
parent f997f3277e
commit d5f9b1d43c
2 changed files with 23 additions and 21 deletions

View File

@@ -158,7 +158,7 @@ class ResultPrinter
if (is_a($object, 'PayPal\Common\PPModel')) {
/** @var $object \PayPal\Common\PPModel */
echo '<pre class="prettyprint '. ($error ? 'error' : '') .'">' . $object->toJSON(128) . "</pre>";
} elseif (\PayPal\Validation\JsonValidator::validate($object, true)) {
} elseif (is_string($object) && \PayPal\Validation\JsonValidator::validate($object, true)) {
echo '<pre class="prettyprint '. ($error ? 'error' : '') .'">'. str_replace('\\/', '/', json_encode(json_decode($object), 128)) . "</pre>";
} elseif (is_string($object)) {
echo '<pre class="prettyprint '. ($error ? 'error' : '') .'">' . $object . '</pre>';