From 1273f622f5707318886af777e688206fee51eb21 Mon Sep 17 00:00:00 2001 From: cryodrift Date: Sun, 14 Dec 2025 09:21:39 +0100 Subject: [PATCH] fix missing protocol class namespace in Worker.php class_exists would search in wrong folder when using own register_autoload callback --- src/Worker.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Worker.php b/src/Worker.php index a80842a36..2f79c683a 100644 --- a/src/Worker.php +++ b/src/Worker.php @@ -2558,11 +2558,12 @@ protected function parseSocketAddress(): ?string // Check application layer protocol class. if (!isset(self::BUILD_IN_TRANSPORTS[$scheme])) { $scheme = ucfirst($scheme); - $this->protocol = $scheme[0] === '\\' ? $scheme : 'Protocols\\' . $scheme; + $protocolNs='Workerman\\Protocols\\'; + $this->protocol = $scheme[0] === '\\' ? $scheme : $protocolNs . $scheme; if (!class_exists($this->protocol)) { - $this->protocol = "Workerman\\Protocols\\$scheme"; + $this->protocol = $protocolNs . $scheme; if (!class_exists($this->protocol)) { - throw new RuntimeException("class \\Protocols\\$scheme not exist"); + throw new RuntimeException("class $protocolNs$scheme not exist"); } }