php-sparkpost
php-sparkpost copied to clipboard
Error with getStatusCode() when doing $promise->wait()
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.
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
Your welcome! :)
The exact same error started occurring for me today. I tried the suggested suggestion, but it doesn't work. Any other ideas?