Skip to content

Commit

Permalink
Merge pull request #304 from i-derevianko/compatibility8.2
Browse files Browse the repository at this point in the history
feat: add compatibility for PHP 8.2
  • Loading branch information
marcosmarcolin authored Apr 8, 2024
2 parents c58667e + 28eadcd commit c9fa2e5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/Engine/Protocols/Http/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ class Request

public $onEnd = null;

public $onClose = null;

public $httpVersion = null;

public $headers = [];
Expand All @@ -20,6 +22,8 @@ class Request

public $connection = null;

public $_query = null;

public function __construct($connection, $raw_head)
{
$this->connection = $connection;
Expand Down
2 changes: 1 addition & 1 deletion src/Engine/Transports/PollingJsonp.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions src/Engine/Transports/WebSocket.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

class WebSocket extends Transport
{
public $sid = null;
public $writable = true;
public $supportsFraming = true;
public $supportsBinary = true;
Expand All @@ -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
Expand Down
7 changes: 5 additions & 2 deletions src/Socket.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}

/**
Expand Down

0 comments on commit c9fa2e5

Please sign in to comment.