You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
webdevlabs
changed the title
Stash is unable to serialize() Closure's in routes
Stash is unable to serialize() Closure in route
Apr 2, 2017
This problem appears only when using the Stash Filesystem Driver, becouse it serializes data before saving it into files (thats good). No problem when using Memcached/APC/Redis. Still not tested with the other drivers.
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.
The text was updated successfully, but these errors were encountered: