Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge #1

Merged
merged 2 commits into from
Dec 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion build/config/phpmd.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<exclude name="ShortVariable"/>
<exclude name="LongVariable"/>
<exclude name="ShortMethodName"/>
<exclude name="ShortClassName"/>
</rule>
<rule ref="rulesets/naming.xml/ShortVariable">
<properties>
Expand All @@ -33,7 +34,11 @@
<property name="minimum" value="2" />
</properties>
</rule>

<rule ref="rulesets/naming.xml/ShortClassName">
<properties>
<property name="minimum" value="2" />
</properties>
</rule>
<rule ref="rulesets/codesize.xml">
<exclude name="TooManyMethods"/>
<exclude name="TooManyPublicMethods"/>
Expand Down
4 changes: 2 additions & 2 deletions src/GameQ/Buffer.php
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,8 @@ public function readStringMulti($delims, &$delimfound = null)
// Get position of delimiters
$pos = [];
foreach ($delims as $delim) {
if ($p = strpos($this->data, $delim, min($this->index, $this->length))) {
$pos[] = $p;
if ($index = strpos($this->data, $delim, min($this->index, $this->length))) {
$pos[] = $index;
}
}

Expand Down
10 changes: 5 additions & 5 deletions src/GameQ/GameQ.php
Original file line number Diff line number Diff line change
Expand Up @@ -410,10 +410,10 @@ protected function doChallenges()
'server_id' => $server_id,
'socket' => $socket,
];
} catch (QueryException $e) {
} catch (QueryException $exception) {
// Check to see if we are in debug, if so bubble up the exception
if ($this->debug) {
throw new \Exception($e->getMessage(), $e->getCode(), $e);
throw new \Exception($exception->getMessage(), $exception->getCode(), $exception);
}
}

Expand Down Expand Up @@ -511,10 +511,10 @@ protected function doQueries()
'server_id' => $server_id,
'socket' => $socket,
];
} catch (QueryException $e) {
} catch (QueryException $exception) {
// Check to see if we are in debug, if so bubble up the exception
if ($this->debug) {
throw new \Exception($e->getMessage(), $e->getCode(), $e);
throw new \Exception($exception->getMessage(), $exception->getCode(), $exception);
}

continue;
Expand Down Expand Up @@ -638,7 +638,7 @@ protected function doApplyFilters(array $results, Server $server)

// Apply the filter to the data
$results = $filter->apply($results, $server);
} catch (\ReflectionException $e) {
} catch (\ReflectionException $exception) {
// Invalid, skip it
continue;
}
Expand Down
14 changes: 7 additions & 7 deletions src/GameQ/Protocols/Ventrilo.php
Original file line number Diff line number Diff line change
Expand Up @@ -778,11 +778,11 @@ protected function decryptPackets(array $packets = [])
$characterCount = count($chars);

$key = 0;
for ($i = 1; $i <= $characterCount; $i++) {
$chars[$i] -= ($table[$a2] + (($i - 1) % 5)) & 0xFF;
for ($index = 1; $index <= $characterCount; $index++) {
$chars[$index] -= ($table[$a2] + (($index - 1) % 5)) & 0xFF;
$a2 = ($a2 + $a1) & 0xFF;
if (($i % 2) == 0) {
$short_array = unpack("n1", pack("C2", $chars[$i - 1], $chars[$i]));
if (($index % 2) == 0) {
$short_array = unpack("n1", pack("C2", $chars[$index - 1], $chars[$index]));
$header_items[$key] = $short_array[1];
++$key;
}
Expand Down Expand Up @@ -818,10 +818,10 @@ protected function decryptPackets(array $packets = [])
$data = "";
$characterCount = count($chars);

for ($i = 1; $i <= $characterCount; $i++) {
$chars[$i] -= ($table[$a2] + (($i - 1) % 72)) & 0xFF;
for ($index = 1; $index <= $characterCount; $index++) {
$chars[$index] -= ($table[$a2] + (($index - 1) % 72)) & 0xFF;
$a2 = ($a2 + $a1) & 0xFF;
$data .= chr($chars[$i]);
$data .= chr($chars[$index]);
}
//@todo: Check CRC ???
$decrypted[$header_items['pck']] = $data;
Expand Down