From 28eadcd9d245b3fb49c8facc87e8d575589acf10 Mon Sep 17 00:00:00 2001 From: "i.derevyanko" Date: Thu, 4 Apr 2024 19:05:12 +0500 Subject: [PATCH] php 8.2 compatibility --- src/Engine/Protocols/Http/Request.php | 4 ++++ src/Engine/Transports/PollingJsonp.php | 2 +- src/Engine/Transports/WebSocket.php | 6 ++++-- src/Socket.php | 7 +++++-- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/Engine/Protocols/Http/Request.php b/src/Engine/Protocols/Http/Request.php index 1fd498a..c908696 100644 --- a/src/Engine/Protocols/Http/Request.php +++ b/src/Engine/Protocols/Http/Request.php @@ -8,6 +8,8 @@ class Request public $onEnd = null; + public $onClose = null; + public $httpVersion = null; public $headers = []; @@ -20,6 +22,8 @@ class Request public $connection = null; + public $_query = null; + public function __construct($connection, $raw_head) { $this->connection = $connection; diff --git a/src/Engine/Transports/PollingJsonp.php b/src/Engine/Transports/PollingJsonp.php index 0db5e2a..86df54d 100644 --- a/src/Engine/Transports/PollingJsonp.php +++ b/src/Engine/Transports/PollingJsonp.php @@ -26,7 +26,7 @@ public function onData($data) $parsed_data = null; parse_str($data, $parsed_data); $data = $parsed_data['d']; - call_user_func([$this, 'parent::onData'], preg_replace('/\\\\n/', '\\n', $data)); + call_user_func(array(get_parent_class($this), 'onData'), preg_replace('/\\\\n/', '\\n', $data)); } public function doWrite($data): void diff --git a/src/Engine/Transports/WebSocket.php b/src/Engine/Transports/WebSocket.php index fbaeaac..97b9a0b 100644 --- a/src/Engine/Transports/WebSocket.php +++ b/src/Engine/Transports/WebSocket.php @@ -8,6 +8,7 @@ class WebSocket extends Transport { + public $sid = null; public $writable = true; public $supportsFraming = true; public $supportsBinary = true; @@ -30,12 +31,13 @@ public function __destruct() public function onData2($connection, $data): void { - call_user_func([$this, 'parent::onData'], $data); + call_user_func(array(get_parent_class($this), 'onData'), $data); + } public function onError2($conection, $code, $msg): void { - call_user_func([$this, 'parent::onClose'], $code, $msg); + call_user_func(array(get_parent_class($this), 'onData'), $code, $msg); } public function send(array $packets): void diff --git a/src/Socket.php b/src/Socket.php index 611b19e..12870c6 100644 --- a/src/Socket.php +++ b/src/Socket.php @@ -23,6 +23,9 @@ class Socket extends Emitter public $acks = []; public $connected = true; public $disconnected = false; + public $handshake = []; + public $userId = null; + public $isGuest = false; public static $events = [ 'error' => 'error', @@ -92,7 +95,7 @@ public function emit($ev = null) { $args = func_get_args(); if (isset(self::$events[$ev])) { - call_user_func_array([__CLASS__, 'parent::emit'], $args); + call_user_func_array(array(get_parent_class(__CLASS__), 'emit'), $args); } else { $packet = []; $packet['type'] = Parser::EVENT; @@ -289,7 +292,7 @@ public function onevent($packet) if (! empty($packet['id']) || (isset($packet['id']) && $packet['id'] === 0)) { $args[] = $this->ack($packet['id']); } - call_user_func_array([__CLASS__, 'parent::emit'], $args); + call_user_func_array(array(get_parent_class(__CLASS__), 'emit'), $args); } /**