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

Error with getStatusCode() when doing $promise->wait() #215

Open
AlexanderBech opened this issue Nov 3, 2023 · 2 comments
Open

Error with getStatusCode() when doing $promise->wait() #215

AlexanderBech opened this issue Nov 3, 2023 · 2 comments

Comments

@AlexanderBech
Copy link

AlexanderBech commented Nov 3, 2023

I'm suddenly getting the following error, when trying to send:

Fatal error: Declaration of SparkPost\SparkPostResponse::getStatusCode() must be compatible with Psr\Http\Message\ResponseInterface::getStatusCode(): int in /var/www/domain.com/public_html/includes/vendor/sparkpost/sparkpost/lib/SparkPost/SparkPostResponse.php on line 109

The error appears when doing:
$response = $promise->wait();

My composer looks like this:
"require": {
"guzzlehttp/guzzle": "^7.0",
"php-http/guzzle7-adapter": "^1",
"sparkpost/sparkpost": "^2",
"php-http/message": "^1.16",
"php-http/message-factory": "^1.1"
},

What is the issue?

I'm running PHP Version 8.2.12.

Update: I suspect this has something to do with something called PSR7, which i have no knowledge about.

Update 2: Solved!
Adding this to my composers require solved it:
"psr/http-message": "^1.1"

It downgraded from 2.0 to 1.1 when adding it manually.

@Taelkir
Copy link

Taelkir commented Nov 20, 2023

Can confirm that psr/http-message @ v1.1 fixes this issue for me too!

Didn't work at first with a composer require psr/http-message - seems like v2.0 is too much.

Thanks @AlexanderBech

@AlexanderBech
Copy link
Author

Your welcome! :)

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