Skip to content

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

Open
@AlexanderBech

Description

@AlexanderBech

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions