diff --git a/src/API.php b/src/API.php index 1942a38..22063d2 100644 --- a/src/API.php +++ b/src/API.php @@ -198,7 +198,7 @@ final class API $x = $this->execute('query',$parameters); - if ((! $x->QueryResponse) || (! $x->QueryResponse->Customer) || (count($x->QueryResponse->Customer) !== 1)) + if ((! $x->QueryResponse) || (! object_get($x->QueryResponse,'Customer')) || (count($x->QueryResponse->Customer) !== 1)) throw new InvalidQueryResultException(sprintf('%s:Query response malformed',self::LOGKEY)); return new Customer($x->QueryResponse); @@ -251,8 +251,8 @@ final class API $x = $this->execute('query',$parameters); - if ((! $x->QueryResponse) || (! $x->QueryResponse->Invoice) || (count($x->QueryResponse->Invoice) !== 1)) - throw new InvalidQueryResultException(sprintf('%s:Query response malformed',self::LOGKEY)); + if ((! $x->QueryResponse) || (! object_get($x->QueryResponse,'Invoice')) || (count($x->QueryResponse->Invoice) !== 1)) + throw new InvalidQueryResultException(sprintf('%s:Query response malformed [%s]',self::LOGKEY,serialize($x))); return new Invoice($x->QueryResponse); }