Applied fixes from StyleCI
This commit is contained in:
parent
4bf443cd64
commit
d96fab3c89
|
@ -128,7 +128,9 @@ class Connection
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public function read_message() {
|
|
||||||
|
public function read_message()
|
||||||
|
{
|
||||||
switch ($this->protocol) {
|
switch ($this->protocol) {
|
||||||
case 'tcp_full':
|
case 'tcp_full':
|
||||||
$packet_length_data = $this->read(4);
|
$packet_length_data = $this->read(4);
|
||||||
|
@ -172,9 +174,12 @@ class Connection
|
||||||
$payload = Tools::fopen_and_write('php://memory', 'rw+b', $packet);
|
$payload = Tools::fopen_and_write('php://memory', 'rw+b', $packet);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $payload;
|
return $payload;
|
||||||
}
|
}
|
||||||
public function send_message($message) {
|
|
||||||
|
public function send_message($message)
|
||||||
|
{
|
||||||
switch ($this->protocol) {
|
switch ($this->protocol) {
|
||||||
case 'tcp_full':
|
case 'tcp_full':
|
||||||
$this->out_seq_no++;
|
$this->out_seq_no++;
|
||||||
|
|
|
@ -71,6 +71,7 @@ class Crypt
|
||||||
}
|
}
|
||||||
$ciphered .= $outdata;
|
$ciphered .= $outdata;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $ciphered;
|
return $ciphered;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,10 +134,8 @@ Slv8kg9qv1m6XHVQY3PnEw+QQtqSIXklHwIDAQAB
|
||||||
array_shift($this->message_ids);
|
array_shift($this->message_ids);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Forming the message frame and sending message to server
|
* Forming the message frame and sending message to server
|
||||||
* :param message: byte string to send.
|
* :param message: byte string to send.
|
||||||
|
@ -200,11 +198,11 @@ Slv8kg9qv1m6XHVQY3PnEw+QQtqSIXklHwIDAQAB
|
||||||
|
|
||||||
$message_data_length = $this->struct->unpack('<I', fread($decrypted_data, 4)) [0];
|
$message_data_length = $this->struct->unpack('<I', fread($decrypted_data, 4)) [0];
|
||||||
|
|
||||||
if ($message_data_length > fstat($decrypted_data)["size"]) {
|
if ($message_data_length > fstat($decrypted_data)['size']) {
|
||||||
throw new Exception('message_data_length is too big');
|
throw new Exception('message_data_length is too big');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((fstat($decrypted_data)["size"] - 32) - $message_data_length > 15) {
|
if ((fstat($decrypted_data)['size'] - 32) - $message_data_length > 15) {
|
||||||
throw new Exception('difference between message_data_length and the length of the remaining decrypted buffer is too big');
|
throw new Exception('difference between message_data_length and the length of the remaining decrypted buffer is too big');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,6 +242,7 @@ DebugTools::hex_dump(substr(sha1(stream_get_contents($decrypted_data, 32 + $mess
|
||||||
throw new Exception('An error occurred while calling method '.$method.'.');
|
throw new Exception('An error occurred while calling method '.$method.'.');
|
||||||
}
|
}
|
||||||
$deserialized = $this->tl->deserialize(Tools::fopen_and_write('php://memory', 'rw+b', $server_answer));
|
$deserialized = $this->tl->deserialize(Tools::fopen_and_write('php://memory', 'rw+b', $server_answer));
|
||||||
|
|
||||||
return $deserialized;
|
return $deserialized;
|
||||||
}
|
}
|
||||||
throw new Exception('An error occurred while calling method '.$method.'.');
|
throw new Exception('An error occurred while calling method '.$method.'.');
|
||||||
|
|
Loading…
Reference in New Issue
Block a user