File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -310,10 +310,15 @@ public function run()
310310 if ($ pipe === null ) {
311311 $ this ->_executeRequest ();
312312 } else {
313- // Propagate errors registry only
313+ // Propagate errors registry
314314 foreach ($ this ->_errorsRegistry as $ code => $ action )
315315 if (!isset ($ pipe [1 ]->_errorsRegistry [$ code ]))
316- $ pipe [1 ]->_errorsRegistry [$ code ] = $ action ;
316+ $ pipe [1 ]->error ($ code , $ action );
317+
318+ // Propagate middlewares registry
319+ foreach ($ this ->_middlewareRegistry as $ middleware )
320+ if (!in_array ($ middleware , $ pipe [1 ]->_middlewareRegistry ))
321+ $ pipe [1 ]->use ($ middleware );
317322
318323 $ pipe [1 ]->_runBase ($ pipe [0 ]);
319324 }
@@ -345,6 +350,9 @@ private function _findSubPipe()
345350
346351 private function _executeRequest ()
347352 {
353+ // Execute middleware
354+ self ::triggerBeforeExecuteEvent (Request::getInstance ());
355+
348356 $ registry = null ;
349357
350358 switch (Request::getInstance ()->getMethod ()) {
@@ -391,9 +399,6 @@ private function _executeRequest()
391399 throw new \Exception ("Malformed route action " );
392400 }
393401
394- // Execute middleware
395- self ::triggerBeforeExecuteEvent (Request::getInstance ());
396-
397402 // NOTE: No code will be executed after this call...
398403 $ this ->_executeAction ($ runner );
399404 }
You can’t perform that action at this time.
0 commit comments