I've noticed this issue when passing cached objects to anonymous functions for routing like
$router->get('/some', function () use ($someting) {});
the Stash caching library is unable to serialize() complicated Closure's in routes.
The problem is visible when we use ($something) and if $something is a cached object inside DI Container.
Normaly we don't need to do this. We can just pass a Controller class instead of objects inside anonymous functions. This is the correct usage: $router->get('/some', ['App\Class','myMethod']);
The solution is to avoid using Closures for Routes.
I've noticed this issue when passing cached objects to anonymous functions for routing like
$router->get('/some', function () use ($someting) {});the Stash caching library is unable to serialize() complicated Closure's in routes.
The problem is visible when we
use ($something)and if $something is a cached object inside DI Container.Normaly we don't need to do this. We can just pass a Controller class instead of objects inside anonymous functions. This is the correct usage:
$router->get('/some', ['App\Class','myMethod']);The solution is to avoid using Closures for Routes.