diff --git a/phpseclib/Crypt/Blowfish.php b/phpseclib/Crypt/Blowfish.php index 89b0a9b0..3cb2b305 100644 --- a/phpseclib/Crypt/Blowfish.php +++ b/phpseclib/Crypt/Blowfish.php @@ -433,7 +433,7 @@ class Blowfish extends BlockCipher $this->bctx['p'][$i ] = $l; $this->bctx['p'][$i + 1] = $r; } - for ($i = 0; $i < 0x400; $i+= 0x100) { + for ($i = 0; $i < 0x400; $i += 0x100) { for ($j = 0; $j < 256; $j += 2) { list($l, $r) = array_values(unpack('N*', $data = $this->encryptBlock($data))); $this->bctx['sb'][$i | $j] = $l; diff --git a/phpseclib/Crypt/EC/PrivateKey.php b/phpseclib/Crypt/EC/PrivateKey.php index 611921cc..91253b8f 100644 --- a/phpseclib/Crypt/EC/PrivateKey.php +++ b/phpseclib/Crypt/EC/PrivateKey.php @@ -266,11 +266,13 @@ final class PrivateKey extends EC implements Common\PrivateKey $temp = new \ReflectionMethod($format, 'save'); $paramCount = $temp->getNumberOfRequiredParameters(); + // @codingStandardsIgnoreStart switch ($paramCount) { case 2: return $format::save($r, $s); case 3: return $format::save($r, $s, $this->getCurve()); case 4: return $format::save($r, $s, $this->getCurve(), $this->getLength()); } + // @codingStandardsIgnoreEnd // presumably the only way you could get to this is if you were using a custom plugin throw new UnsupportedOperationException("$format::save() has $paramCount parameters - the only valid parameter counts are 2 or 3"); diff --git a/phpseclib/Net/SSH2.php b/phpseclib/Net/SSH2.php index 4bd4c9ee..0c096d76 100644 --- a/phpseclib/Net/SSH2.php +++ b/phpseclib/Net/SSH2.php @@ -4490,7 +4490,8 @@ class SSH2 */ protected function send_channel_packet($client_channel, $data) { - if (isset($this->channel_buffers_write[$client_channel]) + if ( + isset($this->channel_buffers_write[$client_channel]) && strpos($data, $this->channel_buffers_write[$client_channel]) === 0 ) { // if buffer holds identical initial data content, resume send from the unmatched data portion diff --git a/tests/Unit/Crypt/RandomTest.php b/tests/Unit/Crypt/RandomTest.php index 95aecfd3..5ab3fe0c 100644 --- a/tests/Unit/Crypt/RandomTest.php +++ b/tests/Unit/Crypt/RandomTest.php @@ -15,7 +15,9 @@ class RandomTest extends PhpseclibTestCase { public static function stringLengthData() { - return array_map(function($x) { return [$x]; }, [ + return array_map(function ($x) { + return [$x]; + }, [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 17, 19, 20, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 111, 128, 1000, 1024, 10000, 12345, 100000, 123456