Skip to content
This repository has been archived by the owner on Dec 16, 2021. It is now read-only.

(with fix) Recoverable fatal error: Argument must be of type array, object given #123

Open
paxcodes opened this issue Jan 29, 2016 · 1 comment

Comments

@paxcodes
Copy link

Here is the full php error:

Recoverable fatal error: Argument 1 passed to Ctct\Exceptions\CtctException::setErrors() must be of the type array, object given, called in /Ctct/Auth/CtctOAuth2.php on line 114 and defined in Ctct\Exceptions\CtctException->setErrors() (line 18 of /Ctct/Exceptions/CtctException.php).

@paxcodes
Copy link
Author

I'll work on making a PR but here is the patch anyway:

diff --git a/src/Ctct/Auth/CtctOAuth2.php b/src/Ctct/Auth/CtctOAuth2.php
index 66eecd4..515bb58 100644
--- a/src/Ctct/Auth/CtctOAuth2.php
+++ b/src/Ctct/Auth/CtctOAuth2.php
@@ -111,7 +111,7 @@ class CtctOAuth2
     private function convertException($exception) {
         $oauth2Exception = new OAuth2Exception($exception->getResponse()->getReasonPhrase(), $exception->getCode());
         $oauth2Exception->setUrl($exception->getResponse()->getEffectiveUrl());
-        $oauth2Exception->setErrors(json_decode($exception->getResponse()->getBody()->getContents()));
+        $oauth2Exception->setErrors(json_decode($exception->getResponse()->getBody()->getContents(), TRUE));
         return $oauth2Exception;
     }
 }

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant