Fix warning messages in websockets classes (#7418)

This commit is contained in:
frytimo
2025-07-11 12:34:35 -03:00
committed by GitHub
parent 66e25ee61b
commit 006dbb88d6
3 changed files with 9 additions and 12 deletions

View File

@@ -527,6 +527,12 @@ class subscriber {
$this->domain_name = $array['domain']['name'] ?? '';
$this->domain_uuid = $array['domain']['uuid'] ?? '';
// Store the permissions
$this->permissions = $array['user']['permissions'] ?? [];
// Remove the permissions from the user array because this class handles them seperately
unset($array['user']['permissions']);
// Add the user information when available
$this->user = $array['user'] ?? [];
@@ -536,9 +542,6 @@ class subscriber {
$this->subscribe($service);
}
// Store the permissions
$this->permissions = $array['permissions'] ?? [];
// Check for service
if (isset($array['service'])) {
//
@@ -804,12 +807,6 @@ class subscriber {
*/
public static function save_token(array $token, array $services, int $time_limit_in_minutes = 0) {
//
// Put the domain_name, permissions, and token in local storage so we can use all the information
// to authenticate an incoming connection from the websocket service.
//
$array['permissions'] = $_SESSION['permissions'] ?? '';
//
// Store the currently logged in user when available
//

View File

@@ -32,7 +32,7 @@
* @author Tim Fry <tim@fusionpbx.com>
*/
class subscriber_missing_permission_exception extends \subscriber_exception {
public function __construct($subscriber_id, string $message = "Subscriber is missing required permission", int $code = 0, ?\Throwable $previous = null): \Exception {
public function __construct($subscriber_id, string $message = "Subscriber is missing required permission", int $code = 0, ?\Throwable $previous = null) {
return parent::__construct($subscriber_id, $message, $code, $previous);
}
}

View File

@@ -311,10 +311,10 @@ class websocket_client {
// Respond with PONG using same payload
$this->send_control_frame(0xA, $payload);
echo "[INFO] Received PING, sent PONG\n";
continue; // Skip returning PING
break 2;
case 0xA: // PONG
echo "[INFO] Received PONG\n";
continue; // Skip returning PONG
break 2;
case 0x1: // TEXT frame
case 0x0: // Continuation frame
$payload_data .= $payload;