Closed matejik closed 5 months ago
Does it work with Slim-Csrf v1.4?
With this code:
$guard->setFailureHandler(function (ServerRequestInterface $request, RequestHandlerInterface $handler) {
$request = $request->withAttribute("csrf_status", false);
return $handler->handle($request);
});
Do you have:
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;
at the top of the file?
Hi, you're right, but it's a stupid mistake. I'm converting a foreign project from Slim 3 to Slim 4, including conversion to PHP 8. I'm sorry.
Glad you found it 👍
Hi, csrf fails to press F5 and resend data. It works without $guard->setFailureHandler, but I need to catch csrf_status.
Thanks Jiri
Fatal error: Uncaught TypeError: DI\Definition\Source\DefinitionFile::{closure}(): Argument #1 ($request) must be of type ServerRequestInterface, Nyholm\Psr7\ServerRequest given, called