diff --git a/HttpServer/Route/Node.php b/HttpServer/Route/Node.php index a859f0c4..e67968a4 100644 --- a/HttpServer/Route/Node.php +++ b/HttpServer/Route/Node.php @@ -98,8 +98,9 @@ class Node extends HttpService */ public function createDispatch(): Closure { - return function () { - return Dispatch::create($this->handler, func_get_args())->dispatch(); + $handler = $this->handler; + return function () use ($handler) { + return Dispatch::create($handler, func_get_args())->dispatch(); }; }