diff --git a/src/Illuminate/Foundation/Configuration/ApplicationBuilder.php b/src/Illuminate/Foundation/Configuration/ApplicationBuilder.php index dde1af231d43..41bcd8b5054a 100644 --- a/src/Illuminate/Foundation/Configuration/ApplicationBuilder.php +++ b/src/Illuminate/Foundation/Configuration/ApplicationBuilder.php @@ -271,14 +271,14 @@ public function withMiddleware(?callable $callback = null) } if ($priorityAppends = $middleware->getMiddlewarePriorityAppends()) { - foreach ($priorityAppends as $middleware => $after) { - $kernel->addToMiddlewarePriorityAfter($after, $middleware); + foreach ($priorityAppends as $newMiddleware => $after) { + $kernel->addToMiddlewarePriorityAfter($after, $newMiddleware); } } if ($priorityPrepends = $middleware->getMiddlewarePriorityPrepends()) { - foreach ($priorityPrepends as $middleware => $before) { - $kernel->addToMiddlewarePriorityBefore($before, $middleware); + foreach ($priorityPrepends as $newMiddleware => $before) { + $kernel->addToMiddlewarePriorityBefore($before, $newMiddleware); } } });