diff --git a/src/ZM/Event/Listener/HttpEventListener.php b/src/ZM/Event/Listener/HttpEventListener.php index 54519339..f01d9151 100644 --- a/src/ZM/Event/Listener/HttpEventListener.php +++ b/src/ZM/Event/Listener/HttpEventListener.php @@ -33,14 +33,14 @@ class HttpEventListener // TODO: 这里有个bug,如果是用的Workerman+Fiber协程的话,有个前置协程挂起,这里获取到的Event是被挂起的Event对象,触发两次事件才能归正 // 跑一遍 BindEvent 绑定了 HttpRequestEvent 的注解 $handler = new AnnotationHandler(BindEvent::class); - $handler->setRuleCallback(fn (BindEvent $anno) => $anno->event_class === HttpRequestEvent::class); + $handler->setRuleCallback(fn (BindEvent $anno) => is_a($anno->event_class, HttpRequestEvent::class, true)); $handler->handleAll($event); // dump($event->getResponse()); $node = null; /** @var null|array $params */ $params = null; // 如果状态是 Normal,那么说明跑了一遍没有阻塞或者其他的情况,我就直接跑一遍内部的路由分发和静态文件分发 - if ($handler->getStatus() === AnnotationHandler::STATUS_NORMAL && $event->getResponse() === null) { + if (($handler->getStatus() === AnnotationHandler::STATUS_NORMAL || $handler->getStatus() === AnnotationHandler::STATUS_RULE_FAILED) && $event->getResponse() === null) { // 解析路由和路由状态 $result = HttpUtil::parseUri($event->getRequest(), $node, $params); switch ($result) {