use references for middleware to fix problems on 5.3

This commit is contained in:
Bernhard Posselt 2014-04-11 20:50:49 +02:00
parent 763da4258e
commit 4af72a076d

View file

@ -92,11 +92,12 @@ class DIContainer extends SimpleContainer implements IAppContainer{
return new SecurityMiddleware($app, $c['Request']);
});
$this['MiddlewareDispatcher'] = $this->share(function($c) {
$middleWares = &$this->middleWares;
$this['MiddlewareDispatcher'] = $this->share(function($c) use (&$middleWares) {
$dispatcher = new MiddlewareDispatcher();
$dispatcher->registerMiddleware($c['SecurityMiddleware']);
foreach($this->middleWares as $middleWare) {
foreach($middleWares as $middleWare) {
$dispatcher->registerMiddleware($c[$middleWare]);
}