forked from LiveCarta/PayPal-PHP-SDK
Fixed Bug in PPModel when empty json string is returned
This commit is contained in:
@@ -151,6 +151,7 @@ class PPModel
|
|||||||
*/
|
*/
|
||||||
public function fromArray($arr)
|
public function fromArray($arr)
|
||||||
{
|
{
|
||||||
|
if (!empty($arr)) {
|
||||||
foreach ($arr as $k => $v) {
|
foreach ($arr as $k => $v) {
|
||||||
if (is_array($v)) {
|
if (is_array($v)) {
|
||||||
$clazz = PPReflectionUtil::getPropertyClass(get_class($this), $k);
|
$clazz = PPReflectionUtil::getPropertyClass(get_class($this), $k);
|
||||||
@@ -176,6 +177,7 @@ class PPModel
|
|||||||
$this->assignValue($k, $v);
|
$this->assignValue($k, $v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ class ResultPrinter
|
|||||||
if (is_a($object, 'PayPal\Common\PPModel')) {
|
if (is_a($object, 'PayPal\Common\PPModel')) {
|
||||||
/** @var $object \PayPal\Common\PPModel */
|
/** @var $object \PayPal\Common\PPModel */
|
||||||
echo '<pre class="prettyprint '. ($error ? 'error' : '') .'">' . $object->toJSON(128) . "</pre>";
|
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>";
|
echo '<pre class="prettyprint '. ($error ? 'error' : '') .'">'. str_replace('\\/', '/', json_encode(json_decode($object), 128)) . "</pre>";
|
||||||
} elseif (is_string($object)) {
|
} elseif (is_string($object)) {
|
||||||
echo '<pre class="prettyprint '. ($error ? 'error' : '') .'">' . $object . '</pre>';
|
echo '<pre class="prettyprint '. ($error ? 'error' : '') .'">' . $object . '</pre>';
|
||||||
|
|||||||
Reference in New Issue
Block a user