Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encountere a error during handling Response in PHP #106

Open
ppprakhar opened this issue Nov 30, 2019 · 1 comment
Open

Encountere a error during handling Response in PHP #106

ppprakhar opened this issue Nov 30, 2019 · 1 comment

Comments

@ppprakhar
Copy link

ppprakhar commented Nov 30, 2019

A PHP Error was encountered
Severity: 4096

Message: Object of class stdClass could not be converted to string

Filename: API/RequestException.php

Line Number: 19

Response Object is below -

object(stdClass)#61 (2) { ["meta"]=> object(stdClass)#62 (2) { ["status"]=> int(400) ["msg"]=> string(11) "Bad Request" } ["response"]=> object(stdClass)#54 (1) { ["errors"]=> array(1) { [0]=> object(stdClass)#60 (2) { ["code"]=> int(8001) ["message"]=> string(21) "Post cannot be empty." } } } }

@ppprakhar
Copy link
Author

May be this is a better solution -
On line no. 18 -
Replace this code -
if (isset($error->response->errors)) { $errstr .= ' ('.$error->response->errors[0].')'; }
with this
if (isset($error->response->errors)) { if (is_object($error->response->errors[0])) { $errstr .= ' (' . $error->response->errors[0]->code . ' - ' . $error->response->errors[0]->message . ')'; } else { $errstr .= ' (' . $error->response->errors[0] . ')'; } }

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

No branches or pull requests

1 participant