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

Problem with submitToGallery($pic['id'],$data) #47

Open
canetti2 opened this issue Oct 28, 2023 · 1 comment
Open

Problem with submitToGallery($pic['id'],$data) #47

canetti2 opened this issue Oct 28, 2023 · 1 comment

Comments

@canetti2
Copy link

Hi,
everything works fine but unfortunatly I get an error when using this function:

$client->api('gallery')->submitToGallery($pic['id'],$data);

Error:
Fatal error: Uncaught TypeError: Imgur\HttpClient\HttpClient::parseResponse(): Return value must be of type array, bool returned in /www/htdocs/w019a155/mysite/imgur/vendor/j0k3r/php-imgur-api-client/lib/Imgur/HttpClient/HttpClient.php:116
Stack trace:
#0 /www/htdocs/w019a155/mysite/imgur/vendor/j0k3r/php-imgur-api-client/lib/Imgur/Api/AbstractApi.php(58): Imgur\HttpClient\HttpClient->parseResponse(Object(GuzzleHttp\Psr7\Response))
#1 /www/htdocs/w019a155/mysite/imgur/vendor/j0k3r/php-imgur-api-client/lib/Imgur/Api/Gallery.php(231): Imgur\Api\AbstractApi->post('gallery/1tGNf19', Array)
#2 /www/htdocs/w019a155/mysite/imgur/authenticationCallBack.php(50): Imgur\Api\Gallery->submitToGallery('1tGNf19', Array)
#3 {main}
thrown in /www/htdocs/w019a155/mysite/imgur/vendor/j0k3r/php-imgur-api-client/lib/Imgur/HttpClient/HttpClient.php on line 116

Do you have an explanation?

@j0k3r
Copy link
Owner

j0k3r commented Nov 12, 2023

Maybe because the data attribute of the response is not always an array but can be null, boolean or integer and the library doesn't seems handle it properly: https://api.imgur.com/models/basic

Try to dump the $responseBody variable here to see what you get

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

2 participants