slimphp / Slim-HttpCache

Slim Framework HTTP cache middleware and service provider
MIT License
115 stars 25 forks source link

Problem with slim 4 #29

Closed X-Tender closed 4 years ago

X-Tender commented 4 years ago

I tried it to add it to slim 4 but I get the error

Fatal error: Uncaught TypeError: Argument 2 passed to Slim\HttpCache\Cache::invoke() must be an instance of Psr\Http\Message\ResponseInterface, instance of Slim\Routing\RouteRunner given, called in /var/www/html/vendor/slim/slim/Slim/MiddlewareDispatcher.php on line 283 and defined in /var/www/html/vendor/slim/http-cache/src/Cache.php:53 Stack trace: #0 /var/www/html/vendor/slim/slim/Slim/MiddlewareDispatcher.php(283): Slim\HttpCache\Cache->invoke(Object(Slim\Http\ServerRequest), Object(Slim\Routing\RouteRunner)) #1 /var/www/html/vendor/slim/slim/Slim/Middleware/ErrorMiddleware.php(98): class@anonymous->handle(Object(Slim\Http\ServerRequest)) #2 /var/www/html/vendor/slim/slim/Slim/MiddlewareDispatcher.php(140): Slim\Middleware\ErrorMiddleware->process(Object(Slim\Http\ServerRequest), Object(class@anonymous)) #3 /var/www/html/vendor/slim/slim/Slim/MiddlewareDispatcher.php(81): class@anonymous->handle(Object(Slim\Http\ServerRequest)) #4 /var/www/html/vendor/slim/slim/Slim/App.php(211): Slim\MiddlewareDispatcher->handle( in /var/www/html/vendor/slim/http-cache/src/Cache.php on line 53

Took a peak into the middleware and the __invoke method didn't have the correct arguments. So is it just not ready form slim 4 or did I missed something?

l0gicgate commented 4 years ago

That's because this middleware is not yet compatible with PSR-15. We need to rewrite it in order to make it compatible.