diff --git a/build/psalm_baseline.xml b/build/psalm_baseline.xml index 078e7204..f3701c3b 100644 --- a/build/psalm_baseline.xml +++ b/build/psalm_baseline.xml @@ -11223,8 +11223,8 @@ $parts['host'] + $parts['path'] $parts['scheme'] - $parts[path] $results[$i + 1] $results[$i] @@ -11313,8 +11313,8 @@ $parts['host'] + $parts['path'] $parts['scheme'] - $parts[path] $decoded[0] @@ -14498,7 +14498,7 @@ readlink realpath - + $a['filename'] $attr['mode'] $b['filename'] @@ -14571,13 +14571,16 @@ $this->realpath($path) $this->server_channels[self::CHANNEL] $this->server_channels[self::CHANNEL] + NET_SFTP_LOGGING - + $props['type'] $props['type'] $result->{$type}[$prop] $temp[$dir] $temp[$dir] + $this->packet_types[$this->packet_type] + $this->packet_types[$type] $this->requestBuffer[$request_id]['packet'] $this->requestBuffer[$request_id]['packet_type'] @@ -14669,7 +14672,7 @@ string string|bool - + $a[$sort] $a[$sort] $attr @@ -14692,6 +14695,8 @@ $subtemp $temp $temp + $this->packet_types[$this->packet_type] + $this->packet_types[$type] $this->realpath($dir . '/..') $value $value @@ -14744,7 +14749,7 @@ false false - + $data $data $data @@ -14752,6 +14757,7 @@ $data $local_file $local_file + $this->realtime_log_file $stat['atime'] @@ -14858,8 +14864,12 @@ bool - + $defaultVersion + $log_size + $realtime_log_file + $realtime_log_size + $realtime_log_wrap $version SFTP SFTP @@ -14878,6 +14888,13 @@ is_string($mode) is_string($mode) && is_int($filename) + + NET_SFTP_LOGGING + + + $this->packet_types + $this->packet_types + break; @@ -15107,7 +15124,7 @@ - + $arg instanceof Agent $arg instanceof PrivateKey || $arg instanceof Agent $request_channel === false @@ -15116,6 +15133,7 @@ is_array($arg) is_array($arg) is_null($this->exit_status) + isset($realtime_log_file) false @@ -15152,16 +15170,15 @@ $host $password - + $keepAlive $quiet_mode - $realtime_log_wrap connect get_channel_packet - + $a['comp'] $a['crypt'] $a['mac'] @@ -15273,8 +15290,9 @@ $type $type $type + NET_SSH2_LOGGING + array_shift($message_log) array_shift($this->channel_buffers[$client_channel]) - array_shift($this->message_log) $diff @@ -15520,13 +15538,12 @@ $packet $packet deflate_add($this->compress_context, $data, ZLIB_PARTIAL_FLUSH) - ftell($this->realtime_log_file) + ftell($realtime_log_file) pack('N', $this->get_seq_no) pack('N', $this->send_seq_no) pack('N', $this->send_seq_no) - - $fp + $this->hmac_create = false @fsockopen($this->host, $this->port, $errno, $errstr, $this->curTimeout == 0 ? 100000 : $this->curTimeout) false @@ -15542,7 +15559,7 @@ false inflate_init(ZLIB_ENCODING_RAW, ['window' => $cinfo + 8]) - + $args $engine $password @@ -15561,6 +15578,7 @@ $this->decompress_context $this->fsock $this->fsock + $this->realtime_log_file $temp['length'] @@ -15571,7 +15589,7 @@ $this->decryptInvocationCounter $this->encryptInvocationCounter - array_shift($this->message_log) + array_shift($message_log) preg_replace_callback('#.#s', fn ($matches) => $this->log_boundary . str_pad(dechex(ord($matches[0])), 2, '0', STR_PAD_LEFT), $fragment) @@ -15655,7 +15673,7 @@ ($callback is callable ? bool : string|bool) - + $agent $curTimeout $decompress_context @@ -15672,6 +15690,7 @@ $port $realtime_log_file $realtime_log_size + $realtime_log_wrap $server_public_host_key $stdErrorLog $timeout @@ -15686,13 +15705,12 @@ isset($this->keyboard_requests_responses) isset($this->realtime_log_file) && is_resource($this->realtime_log_file) - + isset($this->agent) isset($this->agent) isset($this->realtime_log_file) - isset($this->realtime_log_file) - + $payload $payload $payload @@ -15700,6 +15718,7 @@ $payload $payload $payload + $realtime_log_file $response $response $response @@ -15715,6 +15734,10 @@ $hasArray $hasString + + NET_SSH2_LOGGING + NET_SSH2_LOG_REALTIME_FILENAME + withPadding withSignatureFormat diff --git a/phpseclib/File/X509.php b/phpseclib/File/X509.php index 8c95121e..0183f459 100644 --- a/phpseclib/File/X509.php +++ b/phpseclib/File/X509.php @@ -1101,7 +1101,7 @@ class X509 } $path = $parts['path']; if (isset($parts['query'])) { - $path.= '?' . $parts['query']; + $path .= '?' . $parts['query']; } fwrite($fsock, "GET $path HTTP/1.0\r\n"); fwrite($fsock, "Host: $parts[host]\r\n\r\n"); diff --git a/phpseclib/Net/SFTP.php b/phpseclib/Net/SFTP.php index ae03a30d..9a7de538 100644 --- a/phpseclib/Net/SFTP.php +++ b/phpseclib/Net/SFTP.php @@ -3030,7 +3030,7 @@ class SFTP extends SSH2 * * Makes sure that only the last 1MB worth of packets will be logged */ - private function append_log(string $message_number, string $message) + private function append_log(string $message_number, string $message): void { $this->append_log_helper( NET_SFTP_LOGGING, diff --git a/phpseclib/Net/SSH2.php b/phpseclib/Net/SSH2.php index ae94124f..adeeb0f5 100644 --- a/phpseclib/Net/SSH2.php +++ b/phpseclib/Net/SSH2.php @@ -156,7 +156,7 @@ class SSH2 /** * Outputs the message numbers real-time */ - const LOG_SIMPLE_REALTIME = 5; + public const LOG_SIMPLE_REALTIME = 5; /** * Make sure that the log never gets larger than this * @@ -3977,17 +3977,9 @@ class SSH2 /** * Logs data packet helper * - * @param int $constant - * @param string $message_number - * @param string $message - * @param array &$message_number_log - * @param array &$message_log - * @param int &$log_size * @param resource &$realtime_log_file - * @param bool &$realtime_log_wrap - * @param int &$realtime_log_size */ - protected function append_log_helper(int $constant, string $message_number, string $message, array &$message_number_log, array &$message_log, int &$log_size, &$realtime_log_file, bool &$realtime_log_wrap, int &$realtime_log_size) + protected function append_log_helper(int $constant, string $message_number, string $message, array &$message_number_log, array &$message_log, int &$log_size, &$realtime_log_file, bool &$realtime_log_wrap, int &$realtime_log_size): void { // remove the byte identifying the message type from all but the first two messages (ie. the identification strings) if (strlen($message_number) > 2) {