From 938d180751fbfa075f35c5e4fbd07617b6751b3f Mon Sep 17 00:00:00 2001 From: xiak <811800545@qq.com> Date: Wed, 29 Mar 2023 16:22:14 +0800 Subject: [PATCH] =?UTF-8?q?F=20=E4=BF=AE=E5=A4=8D=E5=8F=AF=E8=83=BD?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E7=BD=91=E5=85=B3=E8=BF=9B=E7=A8=8B=E9=80=80?= =?UTF-8?q?=E5=87=BA=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复 gateway-worker 项目中 Gateway::closeClient($client_id, (array) $message); 会导致 网关进程报错退出的问题 --- Protocols/Websocket.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Protocols/Websocket.php b/Protocols/Websocket.php index bba8d2348..17869a820 100644 --- a/Protocols/Websocket.php +++ b/Protocols/Websocket.php @@ -226,9 +226,7 @@ public static function input($buffer, ConnectionInterface $connection) */ public static function encode($buffer, ConnectionInterface $connection) { - if (!is_scalar($buffer)) { - throw new \Exception("You can't send(" . \gettype($buffer) . ") to client, you need to convert it to a string. "); - } + $buffer = (string) $buffer; $len = \strlen($buffer); if (empty($connection->websocketType)) { $connection->websocketType = static::BINARY_TYPE_BLOB;