Slim in PHP 8.1 shows strange errors

I have been using Slim PHP framework to provide my API service (

Recently, I updated my PHP to 8.1 and when I visited the site, it gives the following error:

    "statusCode": 500,
    "error": {
        "type": "SERVER_ERROR",
        "description": "ERROR: Return type of App\\Application\\Actions\\ActionPayload::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice on line 67 in file \/home\/tr\/www\/\/src\/Application\/Actions\/ActionPayload.php."

I have not changed anything in my source code, so I guess the problem raises from Slim framework itself.

Any hints to solve this issue?

Can you please report this bug here? Issues · slimphp/Slim · GitHub

Edit: Here is the Github Issue: Slim in PHP 8.1: site returns error · Issue #3143 · slimphp/Slim · GitHub

This was a Slim-Skeleton issue that’s been fixed.

See slimphp/Slim-Skeleton#252