mirror of
https://github.com/phpseclib/phpseclib.git
synced 2025-01-16 03:22:17 +00:00
Merge branch 'master' of https://github.com/phpseclib/phpseclib
This commit is contained in:
commit
df66aafbe9
24
.github/workflows/ci.yml
vendored
24
.github/workflows/ci.yml
vendored
@ -12,13 +12,16 @@ jobs:
|
|||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php-version }}
|
php-version: ${{ matrix.php-version }}
|
||||||
tools: php-parallel-lint/php-parallel-lint:1
|
env:
|
||||||
|
update: true
|
||||||
|
- name: Composer Install
|
||||||
|
run: composer install --classmap-authoritative --no-interaction --no-cache
|
||||||
- name: Lint
|
- name: Lint
|
||||||
run: parallel-lint --show-deprecated build phpseclib tests
|
run: vendor/bin/parallel-lint --show-deprecated build phpseclib tests
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
php-version: ['8.1']
|
php-version: ['8.1', '8.2']
|
||||||
quality_tools:
|
quality_tools:
|
||||||
name: Quality Tools
|
name: Quality Tools
|
||||||
timeout-minutes: 5
|
timeout-minutes: 5
|
||||||
@ -30,15 +33,18 @@ jobs:
|
|||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: '8.1'
|
php-version: '8.1'
|
||||||
tools: squizlabs/php_codesniffer:3, friendsofphp/php-cs-fixer:3, vimeo/psalm:4
|
env:
|
||||||
|
update: true
|
||||||
- name: Composer Install
|
- name: Composer Install
|
||||||
run: composer install --classmap-authoritative --no-interaction --no-cache
|
run: composer install --classmap-authoritative --no-interaction --no-cache
|
||||||
- name: PHP_CodeSniffer
|
- name: PHP_CodeSniffer
|
||||||
run: phpcs --standard=build/php_codesniffer.xml
|
run: vendor/bin/phpcs --standard=build/php_codesniffer.xml
|
||||||
- name: PHP CS Fixer
|
- name: PHP CS Fixer
|
||||||
run: php-cs-fixer fix --config=build/php-cs-fixer.php --diff --dry-run --using-cache=no
|
run: vendor/bin/php-cs-fixer fix --config=build/php-cs-fixer.php --diff --dry-run --using-cache=no
|
||||||
- name: Psalm
|
- name: Psalm
|
||||||
run: psalm --config=build/psalm.xml --no-cache --long-progress --report-show-info=false
|
run: vendor/bin/psalm --config=build/psalm.xml --no-cache --long-progress --report-show-info=false
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
tests:
|
tests:
|
||||||
name: Tests
|
name: Tests
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
@ -50,6 +56,8 @@ jobs:
|
|||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php-version }}
|
php-version: ${{ matrix.php-version }}
|
||||||
|
env:
|
||||||
|
update: true
|
||||||
- name: Composer Install
|
- name: Composer Install
|
||||||
run: composer install --classmap-authoritative --no-interaction --no-cache --ignore-platform-req=php
|
run: composer install --classmap-authoritative --no-interaction --no-cache --ignore-platform-req=php
|
||||||
- name: Setup Secure Shell Functional Tests
|
- name: Setup Secure Shell Functional Tests
|
||||||
@ -75,7 +83,7 @@ jobs:
|
|||||||
echo "PHPSECLIB_SSH_HOME=/home/phpseclib" >> $GITHUB_ENV
|
echo "PHPSECLIB_SSH_HOME=/home/phpseclib" >> $GITHUB_ENV
|
||||||
echo "SSH_AUTH_SOCK=$SSH_AUTH_SOCK" >> $GITHUB_ENV
|
echo "SSH_AUTH_SOCK=$SSH_AUTH_SOCK" >> $GITHUB_ENV
|
||||||
- name: PHPUnit
|
- name: PHPUnit
|
||||||
run: vendor/bin/phpunit --verbose --configuration tests/phpunit.xml
|
run: vendor/bin/paratest --verbose --configuration=tests/phpunit.xml --runner=WrapperRunner
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
|
@ -88,11 +88,7 @@ Special Thanks to our $50+ sponsors!:
|
|||||||
|
|
||||||
5. Run continuous integration checks:
|
5. Run continuous integration checks:
|
||||||
```sh
|
```sh
|
||||||
composer global require php:^8.1 squizlabs/php_codesniffer friendsofphp/php-cs-fixer vimeo/psalm
|
composer run-script all-quality-tools
|
||||||
phpcs --standard=build/php_codesniffer.xml
|
|
||||||
php-cs-fixer fix --config=build/php-cs-fixer.php --diff --dry-run --using-cache=no
|
|
||||||
psalm --config=build/psalm.xml --no-cache --long-progress --report-show-info=false --output-format=text
|
|
||||||
vendor/bin/phpunit --verbose --configuration tests/phpunit.xml
|
|
||||||
```
|
```
|
||||||
|
|
||||||
6. Send us a Pull Request
|
6. Send us a Pull Request
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<files psalm-version="4.27.0@faf106e717c37b8c81721845dba9de3d8deed8ff">
|
<files psalm-version="4.29.0@7ec5ffbd5f68ae03782d7fd33fff0c45a69f95b3">
|
||||||
<file src="../phpseclib/Common/Functions/Strings.php">
|
<file src="../phpseclib/Common/Functions/Strings.php">
|
||||||
<MissingParamType occurrences="1">
|
<MissingParamType occurrences="1">
|
||||||
<code>$var</code>
|
<code>$var</code>
|
||||||
@ -284,11 +284,7 @@
|
|||||||
<code>$sb_0[$r >> 24 & 0xff]</code>
|
<code>$sb_0[$r >> 24 & 0xff]</code>
|
||||||
<code>self::$parray[$i]</code>
|
<code>self::$parray[$i]</code>
|
||||||
</MixedOperand>
|
</MixedOperand>
|
||||||
<PossiblyFalseArgument occurrences="10">
|
<PossiblyFalseArgument occurrences="6">
|
||||||
<code>$sha2pass</code>
|
|
||||||
<code>$sha2pass</code>
|
|
||||||
<code>$sha2salt</code>
|
|
||||||
<code>$sha2salt</code>
|
|
||||||
<code>unpack('C*', $this->key)</code>
|
<code>unpack('C*', $this->key)</code>
|
||||||
<code>unpack('N*', $data = $this->encryptBlock($data))</code>
|
<code>unpack('N*', $data = $this->encryptBlock($data))</code>
|
||||||
<code>unpack('N*', $data = $this->encryptBlock($data))</code>
|
<code>unpack('N*', $data = $this->encryptBlock($data))</code>
|
||||||
@ -6507,14 +6503,10 @@
|
|||||||
<code>is_string($this->key)</code>
|
<code>is_string($this->key)</code>
|
||||||
<code>is_string($this->nonce)</code>
|
<code>is_string($this->nonce)</code>
|
||||||
</DocblockTypeContradiction>
|
</DocblockTypeContradiction>
|
||||||
<FalsableReturnStatement occurrences="1"/>
|
|
||||||
<ImplicitToStringCast occurrences="2">
|
<ImplicitToStringCast occurrences="2">
|
||||||
<code>$initial[$i]</code>
|
<code>$initial[$i]</code>
|
||||||
<code>$k[$i]</code>
|
<code>$k[$i]</code>
|
||||||
</ImplicitToStringCast>
|
</ImplicitToStringCast>
|
||||||
<InvalidFalsableReturnType occurrences="1">
|
|
||||||
<code>string</code>
|
|
||||||
</InvalidFalsableReturnType>
|
|
||||||
<InvalidOperand occurrences="1">
|
<InvalidOperand occurrences="1">
|
||||||
<code>$matches[2]</code>
|
<code>$matches[2]</code>
|
||||||
</InvalidOperand>
|
</InvalidOperand>
|
||||||
@ -6871,14 +6863,12 @@
|
|||||||
<MixedReturnStatement occurrences="1">
|
<MixedReturnStatement occurrences="1">
|
||||||
<code>$y->toBytes()</code>
|
<code>$y->toBytes()</code>
|
||||||
</MixedReturnStatement>
|
</MixedReturnStatement>
|
||||||
<PossiblyFalseArgument occurrences="8">
|
<PossiblyFalseArgument occurrences="6">
|
||||||
<code>$m[$i]</code>
|
<code>$m[$i]</code>
|
||||||
<code>$m[$i]</code>
|
<code>$m[$i]</code>
|
||||||
<code>$m[$i]</code>
|
<code>$m[$i]</code>
|
||||||
<code>$m[$i]</code>
|
<code>$m[$i]</code>
|
||||||
<code>$m[$i] ?? ''</code>
|
<code>$m[$i] ?? ''</code>
|
||||||
<code>$output</code>
|
|
||||||
<code>$output</code>
|
|
||||||
<code>pack('N4', 0, $index, 0, 1)</code>
|
<code>pack('N4', 0, $index, 0, 1)</code>
|
||||||
</PossiblyFalseArgument>
|
</PossiblyFalseArgument>
|
||||||
<PossiblyFalseIterator occurrences="4">
|
<PossiblyFalseIterator occurrences="4">
|
||||||
@ -14401,57 +14391,32 @@
|
|||||||
<code>$longname</code>
|
<code>$longname</code>
|
||||||
<code>$result</code>
|
<code>$result</code>
|
||||||
</PossiblyUndefinedVariable>
|
</PossiblyUndefinedVariable>
|
||||||
<PossiblyUnusedMethod occurrences="37">
|
<PossiblyUnusedMethod occurrences="17">
|
||||||
<code>chgrp</code>
|
|
||||||
<code>chown</code>
|
|
||||||
<code>clearStatCache</code>
|
|
||||||
<code>disableArbitraryLengthPackets</code>
|
<code>disableArbitraryLengthPackets</code>
|
||||||
<code>disableDatePreservation</code>
|
<code>disableDatePreservation</code>
|
||||||
<code>disablePathCanonicalization</code>
|
<code>disablePathCanonicalization</code>
|
||||||
<code>enableArbitraryLengthPackets</code>
|
<code>enableArbitraryLengthPackets</code>
|
||||||
<code>enableDatePreservation</code>
|
<code>enableDatePreservation</code>
|
||||||
<code>enablePathCanonicalization</code>
|
<code>enablePathCanonicalization</code>
|
||||||
<code>enableStatCache</code>
|
|
||||||
<code>file_exists</code>
|
|
||||||
<code>fileatime</code>
|
<code>fileatime</code>
|
||||||
<code>filegroup</code>
|
<code>filegroup</code>
|
||||||
<code>filemtime</code>
|
<code>filemtime</code>
|
||||||
<code>fileowner</code>
|
<code>fileowner</code>
|
||||||
<code>fileperms</code>
|
<code>fileperms</code>
|
||||||
<code>filetype</code>
|
<code>filetype</code>
|
||||||
<code>get</code>
|
|
||||||
<code>getLastSFTPError</code>
|
|
||||||
<code>getNegotiatedVersion</code>
|
<code>getNegotiatedVersion</code>
|
||||||
<code>getSFTPErrors</code>
|
<code>getSFTPErrors</code>
|
||||||
<code>getSFTPLog</code>
|
<code>getSFTPLog</code>
|
||||||
<code>getSupportedVersions</code>
|
<code>getSupportedVersions</code>
|
||||||
<code>is_dir</code>
|
|
||||||
<code>is_file</code>
|
|
||||||
<code>is_link</code>
|
|
||||||
<code>is_readable</code>
|
|
||||||
<code>is_writeable</code>
|
|
||||||
<code>rawlist</code>
|
|
||||||
<code>readlink</code>
|
|
||||||
<code>rename</code>
|
|
||||||
<code>rmdir</code>
|
|
||||||
<code>setListOrder</code>
|
|
||||||
<code>setPreferredVersion</code>
|
<code>setPreferredVersion</code>
|
||||||
<code>symlink</code>
|
|
||||||
<code>touch</code>
|
|
||||||
<code>truncate</code>
|
|
||||||
</PossiblyUnusedMethod>
|
</PossiblyUnusedMethod>
|
||||||
<PossiblyUnusedReturnValue occurrences="1">
|
<PropertyNotSetInConstructor occurrences="6">
|
||||||
<code>bool</code>
|
|
||||||
</PossiblyUnusedReturnValue>
|
|
||||||
<PropertyNotSetInConstructor occurrences="8">
|
|
||||||
<code>$defaultVersion</code>
|
<code>$defaultVersion</code>
|
||||||
<code>$log_size</code>
|
<code>$log_size</code>
|
||||||
<code>$realtime_log_file</code>
|
<code>$realtime_log_file</code>
|
||||||
<code>$realtime_log_size</code>
|
<code>$realtime_log_size</code>
|
||||||
<code>$realtime_log_wrap</code>
|
<code>$realtime_log_wrap</code>
|
||||||
<code>$version</code>
|
<code>$version</code>
|
||||||
<code>SFTP</code>
|
|
||||||
<code>SFTP</code>
|
|
||||||
</PropertyNotSetInConstructor>
|
</PropertyNotSetInConstructor>
|
||||||
<RedundantCastGivenDocblockType occurrences="1">
|
<RedundantCastGivenDocblockType occurrences="1">
|
||||||
<code>(int) $ver</code>
|
<code>(int) $ver</code>
|
||||||
@ -14520,8 +14485,20 @@
|
|||||||
<code>false</code>
|
<code>false</code>
|
||||||
<code>false</code>
|
<code>false</code>
|
||||||
</FalsableReturnStatement>
|
</FalsableReturnStatement>
|
||||||
<InvalidReturnType occurrences="1">
|
<InvalidArgument occurrences="2">
|
||||||
|
<code>$options & STREAM_MKDIR_RECURSIVE</code>
|
||||||
|
<code>$path</code>
|
||||||
|
</InvalidArgument>
|
||||||
|
<InvalidReturnStatement occurrences="3">
|
||||||
|
<code>$results</code>
|
||||||
|
<code>$results</code>
|
||||||
|
<code>$this->sftp->fsock</code>
|
||||||
|
</InvalidReturnStatement>
|
||||||
|
<InvalidReturnType occurrences="4">
|
||||||
<code>bool</code>
|
<code>bool</code>
|
||||||
|
<code>bool</code>
|
||||||
|
<code>bool</code>
|
||||||
|
<code>resource</code>
|
||||||
</InvalidReturnType>
|
</InvalidReturnType>
|
||||||
<MissingParamType occurrences="1">
|
<MissingParamType occurrences="1">
|
||||||
<code>$var</code>
|
<code>$var</code>
|
||||||
@ -14530,7 +14507,8 @@
|
|||||||
<code>_dir_readdir</code>
|
<code>_dir_readdir</code>
|
||||||
<code>_stream_read</code>
|
<code>_stream_read</code>
|
||||||
</MissingReturnType>
|
</MissingReturnType>
|
||||||
<MixedArgument occurrences="11">
|
<MixedArgument occurrences="14">
|
||||||
|
<code>$atime</code>
|
||||||
<code>$host</code>
|
<code>$host</code>
|
||||||
<code>$host</code>
|
<code>$host</code>
|
||||||
<code>$host</code>
|
<code>$host</code>
|
||||||
@ -14538,10 +14516,12 @@
|
|||||||
<code>$pass</code>
|
<code>$pass</code>
|
||||||
<code>$pass</code>
|
<code>$pass</code>
|
||||||
<code>$port</code>
|
<code>$port</code>
|
||||||
<code>$result</code>
|
<code>$time</code>
|
||||||
<code>$result</code>
|
|
||||||
<code>$user</code>
|
<code>$user</code>
|
||||||
<code>$user</code>
|
<code>$user</code>
|
||||||
|
<code>$var</code>
|
||||||
|
<code>$var</code>
|
||||||
|
<code>$var</code>
|
||||||
</MixedArgument>
|
</MixedArgument>
|
||||||
<MixedArrayAccess occurrences="9">
|
<MixedArrayAccess occurrences="9">
|
||||||
<code>$context[$scheme]</code>
|
<code>$context[$scheme]</code>
|
||||||
@ -14567,18 +14547,13 @@
|
|||||||
<code>self::$instances[$host][$port]</code>
|
<code>self::$instances[$host][$port]</code>
|
||||||
<code>self::$instances[$host][$port]</code>
|
<code>self::$instances[$host][$port]</code>
|
||||||
</MixedArrayOffset>
|
</MixedArrayOffset>
|
||||||
<MixedAssignment occurrences="17">
|
<MixedAssignment occurrences="12">
|
||||||
<code>$argument</code>
|
<code>$argument</code>
|
||||||
<code>$atime</code>
|
<code>$atime</code>
|
||||||
<code>$pass</code>
|
<code>$pass</code>
|
||||||
<code>$pass</code>
|
<code>$pass</code>
|
||||||
<code>$result</code>
|
|
||||||
<code>$result</code>
|
|
||||||
<code>$results</code>
|
|
||||||
<code>$results</code>
|
|
||||||
<code>$sftp</code>
|
<code>$sftp</code>
|
||||||
<code>$sftp</code>
|
<code>$sftp</code>
|
||||||
<code>$this->entries</code>
|
|
||||||
<code>$this->notification</code>
|
<code>$this->notification</code>
|
||||||
<code>$this->pos</code>
|
<code>$this->pos</code>
|
||||||
<code>$this->sftp</code>
|
<code>$this->sftp</code>
|
||||||
@ -14586,38 +14561,9 @@
|
|||||||
<code>$time</code>
|
<code>$time</code>
|
||||||
<code>$user</code>
|
<code>$user</code>
|
||||||
</MixedAssignment>
|
</MixedAssignment>
|
||||||
<MixedInferredReturnType occurrences="7">
|
<MixedInferredReturnType occurrences="1">
|
||||||
<code>bool</code>
|
|
||||||
<code>bool</code>
|
|
||||||
<code>bool</code>
|
|
||||||
<code>bool</code>
|
|
||||||
<code>bool</code>
|
|
||||||
<code>resource</code>
|
|
||||||
<code>string</code>
|
<code>string</code>
|
||||||
</MixedInferredReturnType>
|
</MixedInferredReturnType>
|
||||||
<MixedMethodCall occurrences="21">
|
|
||||||
<code>chgrp</code>
|
|
||||||
<code>chmod</code>
|
|
||||||
<code>chown</code>
|
|
||||||
<code>delete</code>
|
|
||||||
<code>delete</code>
|
|
||||||
<code>filesize</code>
|
|
||||||
<code>get</code>
|
|
||||||
<code>lstat</code>
|
|
||||||
<code>mkdir</code>
|
|
||||||
<code>nlist</code>
|
|
||||||
<code>put</code>
|
|
||||||
<code>rename</code>
|
|
||||||
<code>rename</code>
|
|
||||||
<code>rmdir</code>
|
|
||||||
<code>stat</code>
|
|
||||||
<code>stat</code>
|
|
||||||
<code>stat</code>
|
|
||||||
<code>touch</code>
|
|
||||||
<code>touch</code>
|
|
||||||
<code>truncate</code>
|
|
||||||
<code>truncate</code>
|
|
||||||
</MixedMethodCall>
|
|
||||||
<MixedOperand occurrences="6">
|
<MixedOperand occurrences="6">
|
||||||
<code>$fragment</code>
|
<code>$fragment</code>
|
||||||
<code>$path</code>
|
<code>$path</code>
|
||||||
@ -14626,30 +14572,29 @@
|
|||||||
<code>$path</code>
|
<code>$path</code>
|
||||||
<code>$query</code>
|
<code>$query</code>
|
||||||
</MixedOperand>
|
</MixedOperand>
|
||||||
<MixedReturnStatement occurrences="11">
|
<MixedReturnStatement occurrences="2">
|
||||||
<code>$path</code>
|
<code>$path</code>
|
||||||
<code>$path</code>
|
<code>$path</code>
|
||||||
<code>$results</code>
|
|
||||||
<code>$results</code>
|
|
||||||
<code>$this->sftp->chgrp($path, $var)</code>
|
|
||||||
<code>$this->sftp->chown($path, $var)</code>
|
|
||||||
<code>$this->sftp->delete($path, false)</code>
|
|
||||||
<code>$this->sftp->fsock</code>
|
|
||||||
<code>$this->sftp->mkdir($path, $mode, $options & STREAM_MKDIR_RECURSIVE)</code>
|
|
||||||
<code>$this->sftp->rmdir($path)</code>
|
|
||||||
<code>$this->sftp->touch($path, $time, $atime)</code>
|
|
||||||
</MixedReturnStatement>
|
</MixedReturnStatement>
|
||||||
<PossiblyFalseOperand occurrences="1">
|
<NullableReturnStatement occurrences="1">
|
||||||
|
<code>$this->sftp->fsock</code>
|
||||||
|
</NullableReturnStatement>
|
||||||
|
<PossiblyFalseOperand occurrences="2">
|
||||||
|
<code>$this->size</code>
|
||||||
<code>parse_url($path)</code>
|
<code>parse_url($path)</code>
|
||||||
</PossiblyFalseOperand>
|
</PossiblyFalseOperand>
|
||||||
|
<PossiblyFalsePropertyAssignmentValue occurrences="1">
|
||||||
|
<code>$this->sftp->nlist($path)</code>
|
||||||
|
</PossiblyFalsePropertyAssignmentValue>
|
||||||
|
<PossiblyInvalidArgument occurrences="2">
|
||||||
|
<code>$result</code>
|
||||||
|
<code>$result</code>
|
||||||
|
</PossiblyInvalidArgument>
|
||||||
<PossiblyInvalidArrayAccess occurrences="3">
|
<PossiblyInvalidArrayAccess occurrences="3">
|
||||||
<code>$path1['path']</code>
|
<code>$path1['path']</code>
|
||||||
<code>$path2['path']</code>
|
<code>$path2['path']</code>
|
||||||
<code>$path_to['path']</code>
|
<code>$path_to['path']</code>
|
||||||
</PossiblyInvalidArrayAccess>
|
</PossiblyInvalidArrayAccess>
|
||||||
<PossiblyInvalidPropertyAssignmentValue occurrences="1">
|
|
||||||
<code>$host</code>
|
|
||||||
</PossiblyInvalidPropertyAssignmentValue>
|
|
||||||
<PossiblyNullArrayAccess occurrences="3">
|
<PossiblyNullArrayAccess occurrences="3">
|
||||||
<code>$this->mode[0]</code>
|
<code>$this->mode[0]</code>
|
||||||
<code>$this->mode[0]</code>
|
<code>$this->mode[0]</code>
|
||||||
@ -14682,6 +14627,9 @@
|
|||||||
<code>$sftp</code>
|
<code>$sftp</code>
|
||||||
<code>$size</code>
|
<code>$size</code>
|
||||||
</PropertyNotSetInConstructor>
|
</PropertyNotSetInConstructor>
|
||||||
|
<PropertyTypeCoercion occurrences="1">
|
||||||
|
<code>$host</code>
|
||||||
|
</PropertyTypeCoercion>
|
||||||
<RedundantConditionGivenDocblockType occurrences="4">
|
<RedundantConditionGivenDocblockType occurrences="4">
|
||||||
<code>isset($this->notification) && is_callable($this->notification)</code>
|
<code>isset($this->notification) && is_callable($this->notification)</code>
|
||||||
<code>isset($this->notification) && is_callable($this->notification)</code>
|
<code>isset($this->notification) && is_callable($this->notification)</code>
|
||||||
@ -14703,15 +14651,13 @@
|
|||||||
</UnusedParam>
|
</UnusedParam>
|
||||||
</file>
|
</file>
|
||||||
<file src="../phpseclib/Net/SSH2.php">
|
<file src="../phpseclib/Net/SSH2.php">
|
||||||
<DocblockTypeContradiction occurrences="9">
|
<DocblockTypeContradiction occurrences="7">
|
||||||
<code>$arg instanceof Agent</code>
|
<code>$arg instanceof Agent</code>
|
||||||
<code>$arg instanceof PrivateKey || $arg instanceof Agent</code>
|
<code>$arg instanceof PrivateKey || $arg instanceof Agent</code>
|
||||||
<code>$request_channel === false</code>
|
<code>$request_channel === false</code>
|
||||||
<code>$this->session_id === false</code>
|
|
||||||
<code>is_array($arg)</code>
|
<code>is_array($arg)</code>
|
||||||
<code>is_array($arg)</code>
|
<code>is_array($arg)</code>
|
||||||
<code>is_array($arg)</code>
|
<code>is_array($arg)</code>
|
||||||
<code>is_null($this->exit_status)</code>
|
|
||||||
<code>isset($realtime_log_file)</code>
|
<code>isset($realtime_log_file)</code>
|
||||||
</DocblockTypeContradiction>
|
</DocblockTypeContradiction>
|
||||||
<FalsableReturnStatement occurrences="2">
|
<FalsableReturnStatement occurrences="2">
|
||||||
@ -14730,17 +14676,11 @@
|
|||||||
<code>int</code>
|
<code>int</code>
|
||||||
<code>string</code>
|
<code>string</code>
|
||||||
</InvalidFalsableReturnType>
|
</InvalidFalsableReturnType>
|
||||||
<InvalidNullableReturnType occurrences="1">
|
<InvalidReturnStatement occurrences="1">
|
||||||
<code>bool|SSH2</code>
|
<code>$temp</code>
|
||||||
</InvalidNullableReturnType>
|
</InvalidReturnStatement>
|
||||||
<InvalidPropertyAssignmentValue occurrences="5">
|
<InvalidReturnType occurrences="3">
|
||||||
<code>$this->curTimeout -= $elapsed</code>
|
<code>array<string, SSH2></code>
|
||||||
<code>$this->curTimeout -= $elapsed</code>
|
|
||||||
<code>$this->curTimeout -= $elapsed</code>
|
|
||||||
<code>$this->curTimeout -= $elapsed</code>
|
|
||||||
<code>$this->curTimeout -= $elapsed</code>
|
|
||||||
</InvalidPropertyAssignmentValue>
|
|
||||||
<InvalidReturnType occurrences="2">
|
|
||||||
<code>array{Hash, int}|null</code>
|
<code>array{Hash, int}|null</code>
|
||||||
<code>string</code>
|
<code>string</code>
|
||||||
</InvalidReturnType>
|
</InvalidReturnType>
|
||||||
@ -14750,16 +14690,12 @@
|
|||||||
<code>$password</code>
|
<code>$password</code>
|
||||||
<code>$responses</code>
|
<code>$responses</code>
|
||||||
</MissingParamType>
|
</MissingParamType>
|
||||||
<MissingPropertyType occurrences="2">
|
|
||||||
<code>$keepAlive</code>
|
|
||||||
<code>$quiet_mode</code>
|
|
||||||
</MissingPropertyType>
|
|
||||||
<MissingReturnType occurrences="3">
|
<MissingReturnType occurrences="3">
|
||||||
<code>connect</code>
|
<code>connect</code>
|
||||||
<code>get_channel_packet</code>
|
<code>get_channel_packet</code>
|
||||||
<code>keyboard_interactive_process</code>
|
<code>keyboard_interactive_process</code>
|
||||||
</MissingReturnType>
|
</MissingReturnType>
|
||||||
<MixedArgument occurrences="114">
|
<MixedArgument occurrences="110">
|
||||||
<code>$a['comp']</code>
|
<code>$a['comp']</code>
|
||||||
<code>$a['crypt']</code>
|
<code>$a['crypt']</code>
|
||||||
<code>$a['mac']</code>
|
<code>$a['mac']</code>
|
||||||
@ -14790,7 +14726,6 @@
|
|||||||
<code>$keyBytes</code>
|
<code>$keyBytes</code>
|
||||||
<code>$keyBytes</code>
|
<code>$keyBytes</code>
|
||||||
<code>$length</code>
|
<code>$length</code>
|
||||||
<code>$length</code>
|
|
||||||
<code>$m</code>
|
<code>$m</code>
|
||||||
<code>$m</code>
|
<code>$m</code>
|
||||||
<code>$mac_algorithm_in</code>
|
<code>$mac_algorithm_in</code>
|
||||||
@ -14837,7 +14772,6 @@
|
|||||||
<code>$skip_channel_filter</code>
|
<code>$skip_channel_filter</code>
|
||||||
<code>$stop - $start</code>
|
<code>$stop - $start</code>
|
||||||
<code>$temp</code>
|
<code>$temp</code>
|
||||||
<code>$temp</code>
|
|
||||||
<code>$temp['length']</code>
|
<code>$temp['length']</code>
|
||||||
<code>$theirPublicBytes</code>
|
<code>$theirPublicBytes</code>
|
||||||
<code>$theirPublicBytes</code>
|
<code>$theirPublicBytes</code>
|
||||||
@ -14846,8 +14780,6 @@
|
|||||||
<code>$this->compression_algorithms_server_to_client</code>
|
<code>$this->compression_algorithms_server_to_client</code>
|
||||||
<code>$this->encryption_algorithms_client_to_server</code>
|
<code>$this->encryption_algorithms_client_to_server</code>
|
||||||
<code>$this->encryption_algorithms_server_to_client</code>
|
<code>$this->encryption_algorithms_server_to_client</code>
|
||||||
<code>$this->keepAlive</code>
|
|
||||||
<code>$this->keepAlive</code>
|
|
||||||
<code>$this->kex_algorithm</code>
|
<code>$this->kex_algorithm</code>
|
||||||
<code>$this->kex_algorithm</code>
|
<code>$this->kex_algorithm</code>
|
||||||
<code>$this->kex_algorithm</code>
|
<code>$this->kex_algorithm</code>
|
||||||
@ -14921,7 +14853,7 @@
|
|||||||
<code>$this->window_size_server_to_client[$channel]</code>
|
<code>$this->window_size_server_to_client[$channel]</code>
|
||||||
<code>$this->window_size_server_to_client[$channel]</code>
|
<code>$this->window_size_server_to_client[$channel]</code>
|
||||||
</MixedArrayOffset>
|
</MixedArrayOffset>
|
||||||
<MixedAssignment occurrences="66">
|
<MixedAssignment occurrences="63">
|
||||||
<code>$a</code>
|
<code>$a</code>
|
||||||
<code>$algo</code>
|
<code>$algo</code>
|
||||||
<code>$auth</code>
|
<code>$auth</code>
|
||||||
@ -14941,7 +14873,6 @@
|
|||||||
<code>$kex_algorithms</code>
|
<code>$kex_algorithms</code>
|
||||||
<code>$key</code>
|
<code>$key</code>
|
||||||
<code>$keyBytes</code>
|
<code>$keyBytes</code>
|
||||||
<code>$length</code>
|
|
||||||
<code>$m</code>
|
<code>$m</code>
|
||||||
<code>$mac_algorithm_in</code>
|
<code>$mac_algorithm_in</code>
|
||||||
<code>$mac_algorithm_out</code>
|
<code>$mac_algorithm_out</code>
|
||||||
@ -14969,8 +14900,6 @@
|
|||||||
<code>$server_host_key_algorithms</code>
|
<code>$server_host_key_algorithms</code>
|
||||||
<code>$signature</code>
|
<code>$signature</code>
|
||||||
<code>$temp</code>
|
<code>$temp</code>
|
||||||
<code>$temp</code>
|
|
||||||
<code>$temp[$key]</code>
|
|
||||||
<code>$this->auth_methods_to_continue</code>
|
<code>$this->auth_methods_to_continue</code>
|
||||||
<code>$this->auth_methods_to_continue</code>
|
<code>$this->auth_methods_to_continue</code>
|
||||||
<code>$this->auth_methods_to_continue</code>
|
<code>$this->auth_methods_to_continue</code>
|
||||||
@ -14989,20 +14918,15 @@
|
|||||||
<code>$window_size</code>
|
<code>$window_size</code>
|
||||||
<code>$window_size</code>
|
<code>$window_size</code>
|
||||||
</MixedAssignment>
|
</MixedAssignment>
|
||||||
<MixedInferredReturnType occurrences="5">
|
<MixedInferredReturnType occurrences="4">
|
||||||
<code>bool</code>
|
|
||||||
<code>bool</code>
|
<code>bool</code>
|
||||||
<code>bool</code>
|
<code>bool</code>
|
||||||
<code>boolean</code>
|
<code>boolean</code>
|
||||||
<code>string|bool|null</code>
|
<code>string|bool|null</code>
|
||||||
</MixedInferredReturnType>
|
</MixedInferredReturnType>
|
||||||
<MixedMethodCall occurrences="8">
|
<MixedMethodCall occurrences="4">
|
||||||
<code>decrypt</code>
|
|
||||||
<code>encrypt</code>
|
|
||||||
<code>getCurve</code>
|
<code>getCurve</code>
|
||||||
<code>getEncodedCoordinates</code>
|
<code>getEncodedCoordinates</code>
|
||||||
<code>setNonce</code>
|
|
||||||
<code>setNonce</code>
|
|
||||||
<code>sign</code>
|
<code>sign</code>
|
||||||
<code>withHash</code>
|
<code>withHash</code>
|
||||||
</MixedMethodCall>
|
</MixedMethodCall>
|
||||||
@ -15037,27 +14961,23 @@
|
|||||||
<code>$window_size</code>
|
<code>$window_size</code>
|
||||||
<code>$window_size</code>
|
<code>$window_size</code>
|
||||||
</MixedOperand>
|
</MixedOperand>
|
||||||
<MixedReturnStatement occurrences="6">
|
<MixedReturnStatement occurrences="5">
|
||||||
<code>!Strings::is_stringable($password) && !is_array($password) ? false : $this->keyboard_interactive_process($password)</code>
|
<code>!Strings::is_stringable($password) && !is_array($password) ? false : $this->keyboard_interactive_process($password)</code>
|
||||||
<code>$result</code>
|
<code>$result</code>
|
||||||
<code>$this->errors[$count - 1]</code>
|
<code>$this->errors[$count - 1]</code>
|
||||||
<code>$this->get_channel_packet($channel)</code>
|
<code>$this->get_channel_packet($channel)</code>
|
||||||
<code>$this->keyboard_interactive_process($password)</code>
|
<code>$this->keyboard_interactive_process($password)</code>
|
||||||
<code>$this->quiet_mode</code>
|
|
||||||
</MixedReturnStatement>
|
</MixedReturnStatement>
|
||||||
<MixedReturnTypeCoercion occurrences="4">
|
<MixedReturnTypeCoercion occurrences="2">
|
||||||
<code>$temp</code>
|
|
||||||
<code>$this->errors</code>
|
<code>$this->errors</code>
|
||||||
<code>array<string, SSH2></code>
|
|
||||||
<code>string[]</code>
|
<code>string[]</code>
|
||||||
</MixedReturnTypeCoercion>
|
</MixedReturnTypeCoercion>
|
||||||
<NullableReturnStatement occurrences="1">
|
<PossiblyFalseArgument occurrences="49">
|
||||||
<code>self::$connections[$id] instanceof \WeakReference ? self::$connections[$id]->get() : self::$connections[$id]</code>
|
|
||||||
</NullableReturnStatement>
|
|
||||||
<PossiblyFalseArgument occurrences="46">
|
|
||||||
<code>$data</code>
|
<code>$data</code>
|
||||||
<code>$logged</code>
|
<code>$logged</code>
|
||||||
<code>$nonce</code>
|
<code>$nonce</code>
|
||||||
|
<code>$nonce</code>
|
||||||
|
<code>$nonce</code>
|
||||||
<code>$packet</code>
|
<code>$packet</code>
|
||||||
<code>$packet</code>
|
<code>$packet</code>
|
||||||
<code>$packet</code>
|
<code>$packet</code>
|
||||||
@ -15081,6 +15001,7 @@
|
|||||||
<code>$reconstructed</code>
|
<code>$reconstructed</code>
|
||||||
<code>$tag</code>
|
<code>$tag</code>
|
||||||
<code>$tag</code>
|
<code>$tag</code>
|
||||||
|
<code>$this->hmac_size</code>
|
||||||
<code>$this->server_host_key_algorithms</code>
|
<code>$this->server_host_key_algorithms</code>
|
||||||
<code>$this->server_identifier</code>
|
<code>$this->server_identifier</code>
|
||||||
<code>pack('C', MessageType::REQUEST_FAILURE)</code>
|
<code>pack('C', MessageType::REQUEST_FAILURE)</code>
|
||||||
@ -15128,22 +15049,16 @@
|
|||||||
<code>pack('N', $this->send_seq_no)</code>
|
<code>pack('N', $this->send_seq_no)</code>
|
||||||
<code>pack('N', $this->send_seq_no)</code>
|
<code>pack('N', $this->send_seq_no)</code>
|
||||||
</PossiblyFalseOperand>
|
</PossiblyFalseOperand>
|
||||||
<PossiblyFalsePropertyAssignmentValue occurrences="14">
|
<PossiblyFalsePropertyAssignmentValue occurrences="2">
|
||||||
<code>$this->hmac_create = false</code>
|
|
||||||
<code>@fsockopen($this->host, $this->port, $errno, $errstr, $this->curTimeout == 0 ? 100000 : $this->curTimeout)</code>
|
<code>@fsockopen($this->host, $this->port, $errno, $errstr, $this->curTimeout == 0 ? 100000 : $this->curTimeout)</code>
|
||||||
<code>false</code>
|
|
||||||
<code>false</code>
|
|
||||||
<code>false</code>
|
|
||||||
<code>false</code>
|
|
||||||
<code>false</code>
|
|
||||||
<code>false</code>
|
|
||||||
<code>false</code>
|
|
||||||
<code>false</code>
|
|
||||||
<code>false</code>
|
|
||||||
<code>false</code>
|
|
||||||
<code>false</code>
|
|
||||||
<code>inflate_init(ZLIB_ENCODING_RAW, ['window' => $cinfo + 8])</code>
|
<code>inflate_init(ZLIB_ENCODING_RAW, ['window' => $cinfo + 8])</code>
|
||||||
</PossiblyFalsePropertyAssignmentValue>
|
</PossiblyFalsePropertyAssignmentValue>
|
||||||
|
<PossiblyFalseReference occurrences="4">
|
||||||
|
<code>decrypt</code>
|
||||||
|
<code>encrypt</code>
|
||||||
|
<code>setNonce</code>
|
||||||
|
<code>setNonce</code>
|
||||||
|
</PossiblyFalseReference>
|
||||||
<PossiblyInvalidArgument occurrences="17">
|
<PossiblyInvalidArgument occurrences="17">
|
||||||
<code>$args</code>
|
<code>$args</code>
|
||||||
<code>$engine</code>
|
<code>$engine</code>
|
||||||
@ -15169,7 +15084,8 @@
|
|||||||
<PossiblyInvalidCast occurrences="1">
|
<PossiblyInvalidCast occurrences="1">
|
||||||
<code>$args</code>
|
<code>$args</code>
|
||||||
</PossiblyInvalidCast>
|
</PossiblyInvalidCast>
|
||||||
<PossiblyNullArgument occurrences="4">
|
<PossiblyNullArgument occurrences="5">
|
||||||
|
<code>$this->curTimeout == 0 ? 100000 : $this->curTimeout</code>
|
||||||
<code>$this->decryptInvocationCounter</code>
|
<code>$this->decryptInvocationCounter</code>
|
||||||
<code>$this->encryptInvocationCounter</code>
|
<code>$this->encryptInvocationCounter</code>
|
||||||
<code>array_shift($message_log)</code>
|
<code>array_shift($message_log)</code>
|
||||||
@ -15206,9 +15122,6 @@
|
|||||||
<code>$this->server_channels[self::CHANNEL_SHELL]</code>
|
<code>$this->server_channels[self::CHANNEL_SHELL]</code>
|
||||||
<code>$this->server_channels[self::CHANNEL_SUBSYSTEM]</code>
|
<code>$this->server_channels[self::CHANNEL_SUBSYSTEM]</code>
|
||||||
</PossiblyUndefinedIntArrayOffset>
|
</PossiblyUndefinedIntArrayOffset>
|
||||||
<PossiblyUndefinedMethod occurrences="1">
|
|
||||||
<code>get</code>
|
|
||||||
</PossiblyUndefinedMethod>
|
|
||||||
<PossiblyUndefinedStringArrayOffset occurrences="1">
|
<PossiblyUndefinedStringArrayOffset occurrences="1">
|
||||||
<code>$temp['length']</code>
|
<code>$temp['length']</code>
|
||||||
</PossiblyUndefinedStringArrayOffset>
|
</PossiblyUndefinedStringArrayOffset>
|
||||||
@ -15250,24 +15163,24 @@
|
|||||||
<code>startSubsystem</code>
|
<code>startSubsystem</code>
|
||||||
<code>stopSubsystem</code>
|
<code>stopSubsystem</code>
|
||||||
</PossiblyUnusedMethod>
|
</PossiblyUnusedMethod>
|
||||||
<PossiblyUnusedProperty occurrences="1">
|
|
||||||
<code>$preferred_signature_format</code>
|
|
||||||
</PossiblyUnusedProperty>
|
|
||||||
<PossiblyUnusedReturnValue occurrences="1">
|
<PossiblyUnusedReturnValue occurrences="1">
|
||||||
<code>($callback is callable ? bool : string|bool)</code>
|
<code>($callback is callable ? bool : string|bool)</code>
|
||||||
</PossiblyUnusedReturnValue>
|
</PossiblyUnusedReturnValue>
|
||||||
<PropertyNotSetInConstructor occurrences="20">
|
<PropertyNotSetInConstructor occurrences="22">
|
||||||
<code>$agent</code>
|
<code>$agent</code>
|
||||||
<code>$curTimeout</code>
|
|
||||||
<code>$decompress_context</code>
|
<code>$decompress_context</code>
|
||||||
<code>$exit_status</code>
|
<code>$decryptFixedPart</code>
|
||||||
|
<code>$decryptInvocationCounter</code>
|
||||||
|
<code>$decryptName</code>
|
||||||
|
<code>$encryptFixedPart</code>
|
||||||
|
<code>$encryptInvocationCounter</code>
|
||||||
|
<code>$encryptName</code>
|
||||||
<code>$hmac_check_etm</code>
|
<code>$hmac_check_etm</code>
|
||||||
<code>$hmac_check_name</code>
|
<code>$hmac_check_name</code>
|
||||||
<code>$hmac_create_etm</code>
|
<code>$hmac_create_etm</code>
|
||||||
<code>$hmac_create_name</code>
|
<code>$hmac_create_name</code>
|
||||||
<code>$host</code>
|
<code>$host</code>
|
||||||
<code>$identifier</code>
|
<code>$identifier</code>
|
||||||
<code>$in_subsystem</code>
|
|
||||||
<code>$last_packet</code>
|
<code>$last_packet</code>
|
||||||
<code>$log_size</code>
|
<code>$log_size</code>
|
||||||
<code>$port</code>
|
<code>$port</code>
|
||||||
@ -15276,13 +15189,13 @@
|
|||||||
<code>$realtime_log_wrap</code>
|
<code>$realtime_log_wrap</code>
|
||||||
<code>$server_public_host_key</code>
|
<code>$server_public_host_key</code>
|
||||||
<code>$stdErrorLog</code>
|
<code>$stdErrorLog</code>
|
||||||
<code>$timeout</code>
|
|
||||||
</PropertyNotSetInConstructor>
|
</PropertyNotSetInConstructor>
|
||||||
<RedundantConditionGivenDocblockType occurrences="5">
|
<RedundantCondition occurrences="1">
|
||||||
<code>$this->session_id !== false</code>
|
<code>isset($this->keyboard_requests_responses)</code>
|
||||||
|
</RedundantCondition>
|
||||||
|
<RedundantConditionGivenDocblockType occurrences="3">
|
||||||
<code>Strings::is_stringable($arg)</code>
|
<code>Strings::is_stringable($arg)</code>
|
||||||
<code>is_bool($agent_response)</code>
|
<code>is_bool($agent_response)</code>
|
||||||
<code>isset($this->keyboard_requests_responses)</code>
|
|
||||||
<code>isset($this->realtime_log_file) && is_resource($this->realtime_log_file)</code>
|
<code>isset($this->realtime_log_file) && is_resource($this->realtime_log_file)</code>
|
||||||
</RedundantConditionGivenDocblockType>
|
</RedundantConditionGivenDocblockType>
|
||||||
<RedundantPropertyInitializationCheck occurrences="3">
|
<RedundantPropertyInitializationCheck occurrences="3">
|
||||||
@ -15368,9 +15281,7 @@
|
|||||||
<code>$length</code>
|
<code>$length</code>
|
||||||
<code>$temp</code>
|
<code>$temp</code>
|
||||||
</MixedArgument>
|
</MixedArgument>
|
||||||
<MixedAssignment occurrences="8">
|
<MixedAssignment occurrences="6">
|
||||||
<code>$address</code>
|
|
||||||
<code>$address</code>
|
|
||||||
<code>$agent_data_bytes</code>
|
<code>$agent_data_bytes</code>
|
||||||
<code>$agent_reply_bytes</code>
|
<code>$agent_reply_bytes</code>
|
||||||
<code>$agent_reply_data</code>
|
<code>$agent_reply_data</code>
|
||||||
@ -15443,14 +15354,6 @@
|
|||||||
<code>$type</code>
|
<code>$type</code>
|
||||||
</UnusedVariable>
|
</UnusedVariable>
|
||||||
</file>
|
</file>
|
||||||
<file src="../phpseclib/bootstrap.php">
|
|
||||||
<InvalidOperand occurrences="1">
|
|
||||||
<code>ini_get('mbstring.func_overload')</code>
|
|
||||||
</InvalidOperand>
|
|
||||||
<PossiblyFalseOperand occurrences="1">
|
|
||||||
<code>ini_get('mbstring.func_overload')</code>
|
|
||||||
</PossiblyFalseOperand>
|
|
||||||
</file>
|
|
||||||
<file src="../tests/Functional/Net/SFTPLargeFileTest.php">
|
<file src="../tests/Functional/Net/SFTPLargeFileTest.php">
|
||||||
<PropertyNotSetInConstructor occurrences="3">
|
<PropertyNotSetInConstructor occurrences="3">
|
||||||
<code>SFTPLargeFileTest</code>
|
<code>SFTPLargeFileTest</code>
|
||||||
@ -15503,48 +15406,18 @@
|
|||||||
</RedundantConditionGivenDocblockType>
|
</RedundantConditionGivenDocblockType>
|
||||||
</file>
|
</file>
|
||||||
<file src="../tests/Functional/Net/SFTPUserStoryTest.php">
|
<file src="../tests/Functional/Net/SFTPUserStoryTest.php">
|
||||||
<MissingParamType occurrences="35">
|
<InvalidScalarArgument occurrences="3">
|
||||||
|
<code>SORT_ASC</code>
|
||||||
|
<code>SORT_DESC</code>
|
||||||
|
<code>SORT_DESC</code>
|
||||||
|
</InvalidScalarArgument>
|
||||||
|
<MissingParamType occurrences="1">
|
||||||
<code>$length</code>
|
<code>$length</code>
|
||||||
<code>$sftp</code>
|
|
||||||
<code>$sftp</code>
|
|
||||||
<code>$sftp</code>
|
|
||||||
<code>$sftp</code>
|
|
||||||
<code>$sftp</code>
|
|
||||||
<code>$sftp</code>
|
|
||||||
<code>$sftp</code>
|
|
||||||
<code>$sftp</code>
|
|
||||||
<code>$sftp</code>
|
|
||||||
<code>$sftp</code>
|
|
||||||
<code>$sftp</code>
|
|
||||||
<code>$sftp</code>
|
|
||||||
<code>$sftp</code>
|
|
||||||
<code>$sftp</code>
|
|
||||||
<code>$sftp</code>
|
|
||||||
<code>$sftp</code>
|
|
||||||
<code>$sftp</code>
|
|
||||||
<code>$sftp</code>
|
|
||||||
<code>$sftp</code>
|
|
||||||
<code>$sftp</code>
|
|
||||||
<code>$sftp</code>
|
|
||||||
<code>$sftp</code>
|
|
||||||
<code>$sftp</code>
|
|
||||||
<code>$sftp</code>
|
|
||||||
<code>$sftp</code>
|
|
||||||
<code>$sftp</code>
|
|
||||||
<code>$sftp</code>
|
|
||||||
<code>$sftp</code>
|
|
||||||
<code>$sftp</code>
|
|
||||||
<code>$sftp</code>
|
|
||||||
<code>$sftp</code>
|
|
||||||
<code>$sftp</code>
|
|
||||||
<code>$sftp</code>
|
|
||||||
<code>$sftp</code>
|
|
||||||
</MissingParamType>
|
</MissingParamType>
|
||||||
<MissingPropertyType occurrences="4">
|
<MissingPropertyType occurrences="3">
|
||||||
<code>$buffer</code>
|
<code>$buffer</code>
|
||||||
<code>$exampleData</code>
|
<code>$exampleData</code>
|
||||||
<code>$exampleDataLength</code>
|
<code>$exampleDataLength</code>
|
||||||
<code>$scratchDir</code>
|
|
||||||
</MissingPropertyType>
|
</MissingPropertyType>
|
||||||
<MissingReturnType occurrences="34">
|
<MissingReturnType occurrences="34">
|
||||||
<code>demoCallback</code>
|
<code>demoCallback</code>
|
||||||
@ -15583,17 +15456,42 @@
|
|||||||
<code>testUploadOffsets</code>
|
<code>testUploadOffsets</code>
|
||||||
</MissingReturnType>
|
</MissingReturnType>
|
||||||
<MixedArgument occurrences="9">
|
<MixedArgument occurrences="9">
|
||||||
|
<code>$file</code>
|
||||||
<code>$length</code>
|
<code>$length</code>
|
||||||
|
<code>$sftp::SOURCE_CALLBACK</code>
|
||||||
|
<code>$stat['gid']</code>
|
||||||
|
<code>$stat['uid']</code>
|
||||||
|
<code>self::$buffer</code>
|
||||||
|
<code>self::$exampleData</code>
|
||||||
|
<code>self::$exampleData</code>
|
||||||
|
<code>self::$exampleDataLength - 100</code>
|
||||||
|
</MixedArgument>
|
||||||
|
<MixedAssignment occurrences="4">
|
||||||
|
<code>$cur_size</code>
|
||||||
|
<code>$file</code>
|
||||||
|
<code>$last_size</code>
|
||||||
|
<code>self::$buffer</code>
|
||||||
|
</MixedAssignment>
|
||||||
|
<MixedOperand occurrences="3">
|
||||||
|
<code>self::$exampleData</code>
|
||||||
|
<code>self::$exampleDataLength</code>
|
||||||
|
<code>self::$exampleDataLength</code>
|
||||||
|
</MixedOperand>
|
||||||
|
<PossiblyFalseArgument occurrences="3">
|
||||||
|
<code>$fp</code>
|
||||||
|
<code>$fp</code>
|
||||||
|
<code>$fp</code>
|
||||||
|
</PossiblyFalseArgument>
|
||||||
|
<PossiblyFalseIterator occurrences="1">
|
||||||
|
<code>$files</code>
|
||||||
|
</PossiblyFalseIterator>
|
||||||
|
<PossiblyInvalidArgument occurrences="4">
|
||||||
|
<code>$pwd</code>
|
||||||
<code>$pwd</code>
|
<code>$pwd</code>
|
||||||
<code>$sftp->pwd()</code>
|
<code>$sftp->pwd()</code>
|
||||||
<code>$sftp->pwd()</code>
|
<code>$sftp->pwd()</code>
|
||||||
<code>self::$buffer</code>
|
</PossiblyInvalidArgument>
|
||||||
<code>self::$exampleData</code>
|
<PossiblyInvalidArrayAccess occurrences="14">
|
||||||
<code>self::$scratchDir</code>
|
|
||||||
<code>self::$scratchDir</code>
|
|
||||||
<code>self::$scratchDir</code>
|
|
||||||
</MixedArgument>
|
|
||||||
<MixedArrayAccess occurrences="14">
|
|
||||||
<code>$stat2['gid']</code>
|
<code>$stat2['gid']</code>
|
||||||
<code>$stat2['uid']</code>
|
<code>$stat2['uid']</code>
|
||||||
<code>$stat['gid']</code>
|
<code>$stat['gid']</code>
|
||||||
@ -15608,176 +15506,23 @@
|
|||||||
<code>$stat['type']</code>
|
<code>$stat['type']</code>
|
||||||
<code>$stat['uid']</code>
|
<code>$stat['uid']</code>
|
||||||
<code>$stat['uid']</code>
|
<code>$stat['uid']</code>
|
||||||
</MixedArrayAccess>
|
</PossiblyInvalidArrayAccess>
|
||||||
<MixedAssignment occurrences="25">
|
<PossiblyUndefinedStringArrayOffset occurrences="14">
|
||||||
<code>$cur_size</code>
|
<code>$stat2['gid']</code>
|
||||||
<code>$dirname</code>
|
<code>$stat2['uid']</code>
|
||||||
<code>$file</code>
|
<code>$stat['gid']</code>
|
||||||
<code>$files</code>
|
<code>$stat['gid']</code>
|
||||||
<code>$last_size</code>
|
<code>$stat['type']</code>
|
||||||
<code>$list</code>
|
<code>$stat['type']</code>
|
||||||
<code>$list</code>
|
<code>$stat['type']</code>
|
||||||
<code>$list_cache_disabled</code>
|
<code>$stat['type']</code>
|
||||||
<code>$list_cache_enabled</code>
|
<code>$stat['type']</code>
|
||||||
<code>$lstat</code>
|
<code>$stat['type']</code>
|
||||||
<code>$lstat</code>
|
<code>$stat['type']</code>
|
||||||
<code>$pwd</code>
|
<code>$stat['type']</code>
|
||||||
<code>$stat</code>
|
<code>$stat['uid']</code>
|
||||||
<code>$stat</code>
|
<code>$stat['uid']</code>
|
||||||
<code>$stat</code>
|
</PossiblyUndefinedStringArrayOffset>
|
||||||
<code>$stat</code>
|
|
||||||
<code>$stat</code>
|
|
||||||
<code>$stat</code>
|
|
||||||
<code>$stat</code>
|
|
||||||
<code>$stat</code>
|
|
||||||
<code>$stat</code>
|
|
||||||
<code>$stat</code>
|
|
||||||
<code>$stat</code>
|
|
||||||
<code>$stat2</code>
|
|
||||||
<code>self::$buffer</code>
|
|
||||||
</MixedAssignment>
|
|
||||||
<MixedMethodCall occurrences="130">
|
|
||||||
<code>chdir</code>
|
|
||||||
<code>chdir</code>
|
|
||||||
<code>chdir</code>
|
|
||||||
<code>chdir</code>
|
|
||||||
<code>chdir</code>
|
|
||||||
<code>chdir</code>
|
|
||||||
<code>chdir</code>
|
|
||||||
<code>chdir</code>
|
|
||||||
<code>chdir</code>
|
|
||||||
<code>chgrp</code>
|
|
||||||
<code>chmod</code>
|
|
||||||
<code>chmod</code>
|
|
||||||
<code>chmod</code>
|
|
||||||
<code>chown</code>
|
|
||||||
<code>clearStatCache</code>
|
|
||||||
<code>clearStatCache</code>
|
|
||||||
<code>clearStatCache</code>
|
|
||||||
<code>delete</code>
|
|
||||||
<code>delete</code>
|
|
||||||
<code>delete</code>
|
|
||||||
<code>disableStatCache</code>
|
|
||||||
<code>disableStatCache</code>
|
|
||||||
<code>enablePTY</code>
|
|
||||||
<code>enableStatCache</code>
|
|
||||||
<code>exec</code>
|
|
||||||
<code>file_exists</code>
|
|
||||||
<code>file_exists</code>
|
|
||||||
<code>file_exists</code>
|
|
||||||
<code>file_exists</code>
|
|
||||||
<code>file_exists</code>
|
|
||||||
<code>filesize</code>
|
|
||||||
<code>filesize</code>
|
|
||||||
<code>filesize</code>
|
|
||||||
<code>filesize</code>
|
|
||||||
<code>filesize</code>
|
|
||||||
<code>filesize</code>
|
|
||||||
<code>get</code>
|
|
||||||
<code>get</code>
|
|
||||||
<code>get</code>
|
|
||||||
<code>get</code>
|
|
||||||
<code>get</code>
|
|
||||||
<code>get</code>
|
|
||||||
<code>get</code>
|
|
||||||
<code>is_dir</code>
|
|
||||||
<code>is_dir</code>
|
|
||||||
<code>is_dir</code>
|
|
||||||
<code>is_dir</code>
|
|
||||||
<code>is_dir</code>
|
|
||||||
<code>is_dir</code>
|
|
||||||
<code>is_file</code>
|
|
||||||
<code>is_file</code>
|
|
||||||
<code>is_file</code>
|
|
||||||
<code>is_file</code>
|
|
||||||
<code>is_file</code>
|
|
||||||
<code>is_file</code>
|
|
||||||
<code>is_file</code>
|
|
||||||
<code>is_link</code>
|
|
||||||
<code>is_readable</code>
|
|
||||||
<code>is_readable</code>
|
|
||||||
<code>is_readable</code>
|
|
||||||
<code>is_writable</code>
|
|
||||||
<code>is_writable</code>
|
|
||||||
<code>is_writable</code>
|
|
||||||
<code>is_writeable</code>
|
|
||||||
<code>is_writeable</code>
|
|
||||||
<code>is_writeable</code>
|
|
||||||
<code>login</code>
|
|
||||||
<code>lstat</code>
|
|
||||||
<code>lstat</code>
|
|
||||||
<code>lstat</code>
|
|
||||||
<code>lstat</code>
|
|
||||||
<code>lstat</code>
|
|
||||||
<code>lstat</code>
|
|
||||||
<code>mkdir</code>
|
|
||||||
<code>mkdir</code>
|
|
||||||
<code>mkdir</code>
|
|
||||||
<code>mkdir</code>
|
|
||||||
<code>mkdir</code>
|
|
||||||
<code>mkdir</code>
|
|
||||||
<code>mkdir</code>
|
|
||||||
<code>mkdir</code>
|
|
||||||
<code>mkdir</code>
|
|
||||||
<code>nlist</code>
|
|
||||||
<code>nlist</code>
|
|
||||||
<code>nlist</code>
|
|
||||||
<code>nlist</code>
|
|
||||||
<code>nlist</code>
|
|
||||||
<code>nlist</code>
|
|
||||||
<code>put</code>
|
|
||||||
<code>put</code>
|
|
||||||
<code>put</code>
|
|
||||||
<code>put</code>
|
|
||||||
<code>put</code>
|
|
||||||
<code>put</code>
|
|
||||||
<code>put</code>
|
|
||||||
<code>put</code>
|
|
||||||
<code>put</code>
|
|
||||||
<code>pwd</code>
|
|
||||||
<code>pwd</code>
|
|
||||||
<code>pwd</code>
|
|
||||||
<code>pwd</code>
|
|
||||||
<code>pwd</code>
|
|
||||||
<code>rawlist</code>
|
|
||||||
<code>rawlist</code>
|
|
||||||
<code>readlink</code>
|
|
||||||
<code>rmdir</code>
|
|
||||||
<code>rmdir</code>
|
|
||||||
<code>setListOrder</code>
|
|
||||||
<code>setListOrder</code>
|
|
||||||
<code>setListOrder</code>
|
|
||||||
<code>stat</code>
|
|
||||||
<code>stat</code>
|
|
||||||
<code>stat</code>
|
|
||||||
<code>stat</code>
|
|
||||||
<code>stat</code>
|
|
||||||
<code>stat</code>
|
|
||||||
<code>stat</code>
|
|
||||||
<code>stat</code>
|
|
||||||
<code>stat</code>
|
|
||||||
<code>stat</code>
|
|
||||||
<code>stat</code>
|
|
||||||
<code>symlink</code>
|
|
||||||
<code>symlink</code>
|
|
||||||
<code>symlink</code>
|
|
||||||
<code>touch</code>
|
|
||||||
<code>touch</code>
|
|
||||||
<code>touch</code>
|
|
||||||
<code>touch</code>
|
|
||||||
<code>truncate</code>
|
|
||||||
<code>truncate</code>
|
|
||||||
</MixedMethodCall>
|
|
||||||
<MixedOperand occurrences="4">
|
|
||||||
<code>self::$exampleData</code>
|
|
||||||
<code>self::$exampleDataLength</code>
|
|
||||||
<code>self::$exampleDataLength</code>
|
|
||||||
<code>self::$scratchDir</code>
|
|
||||||
</MixedOperand>
|
|
||||||
<PossiblyFalseArgument occurrences="2">
|
|
||||||
<code>$fp</code>
|
|
||||||
<code>$fp</code>
|
|
||||||
</PossiblyFalseArgument>
|
|
||||||
<PropertyNotSetInConstructor occurrences="2">
|
<PropertyNotSetInConstructor occurrences="2">
|
||||||
<code>SFTPUserStoryTest</code>
|
<code>SFTPUserStoryTest</code>
|
||||||
<code>SFTPUserStoryTest</code>
|
<code>SFTPUserStoryTest</code>
|
||||||
|
@ -62,7 +62,11 @@
|
|||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"ext-xml": "*",
|
"ext-xml": "*",
|
||||||
"phpunit/phpunit": "*"
|
"brianium/paratest": "^6.6",
|
||||||
|
"friendsofphp/php-cs-fixer": "^3.12",
|
||||||
|
"php-parallel-lint/php-parallel-lint": "^1.3",
|
||||||
|
"squizlabs/php_codesniffer": "^3.7",
|
||||||
|
"vimeo/psalm": "^4.29"
|
||||||
},
|
},
|
||||||
"suggest": {
|
"suggest": {
|
||||||
"ext-libsodium": "SSH2/SFTP can make use of some algorithms provided by the libsodium-php extension.",
|
"ext-libsodium": "SSH2/SFTP can make use of some algorithms provided by the libsodium-php extension.",
|
||||||
@ -71,9 +75,6 @@
|
|||||||
"ext-dom": "Install the DOM extension to load XML formatted public keys."
|
"ext-dom": "Install the DOM extension to load XML formatted public keys."
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"files": [
|
|
||||||
"phpseclib/bootstrap.php"
|
|
||||||
],
|
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"phpseclib3\\": "phpseclib/"
|
"phpseclib3\\": "phpseclib/"
|
||||||
}
|
}
|
||||||
@ -87,14 +88,14 @@
|
|||||||
"sort-packages": true
|
"sort-packages": true
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "parallel-lint --show-deprecated build phpseclib tests",
|
"lint": "vendor/bin/parallel-lint --show-deprecated build phpseclib tests",
|
||||||
"php_codesniffer": "phpcs --standard=build/php_codesniffer.xml",
|
"php_codesniffer": "vendor/bin/phpcs --standard=build/php_codesniffer.xml",
|
||||||
"php_codesniffer-fix": "phpcbf --standard=build/php_codesniffer.xml",
|
"php_codesniffer-fix": "vendor/bin/phpcbf --standard=build/php_codesniffer.xml",
|
||||||
"php-cs-fixer": "php-cs-fixer fix --config=build/php-cs-fixer.php --diff --using-cache=no --dry-run",
|
"php-cs-fixer": "vendor/bin/php-cs-fixer fix --config=build/php-cs-fixer.php --diff --using-cache=no --dry-run",
|
||||||
"php-cs-fixer-fix": "php-cs-fixer fix --config=build/php-cs-fixer.php --diff --using-cache=no",
|
"php-cs-fixer-fix": "vendor/bin/php-cs-fixer fix --config=build/php-cs-fixer.php --diff --using-cache=no",
|
||||||
"psalm": "psalm --config=build/psalm.xml --no-cache --long-progress",
|
"psalm": "vendor/bin/psalm --config=build/psalm.xml --no-cache --long-progress --threads=4",
|
||||||
"psalm-set-baseline": "psalm --config=build/psalm.xml --no-cache --long-progress --set-baseline=psalm_baseline.xml",
|
"psalm-set-baseline": "vendor/bin/psalm --config=build/psalm.xml --no-cache --long-progress --set-baseline=psalm_baseline.xml --threads=4",
|
||||||
"test": "vendor/bin/phpunit --configuration tests/phpunit.xml",
|
"test": "vendor/bin/paratest --verbose --configuration=tests/phpunit.xml --runner=WrapperRunner",
|
||||||
"all-quality-tools": [
|
"all-quality-tools": [
|
||||||
"@lint",
|
"@lint",
|
||||||
"@phpcs",
|
"@phpcs",
|
||||||
|
@ -105,10 +105,9 @@ class SFTP extends SSH2
|
|||||||
* The request ID exists in the off chance that a packet is sent out-of-order. Of course, this library doesn't support
|
* The request ID exists in the off chance that a packet is sent out-of-order. Of course, this library doesn't support
|
||||||
* concurrent actions, so it's somewhat academic, here.
|
* concurrent actions, so it's somewhat academic, here.
|
||||||
*
|
*
|
||||||
* @var boolean
|
|
||||||
* @see self::_send_sftp_packet()
|
* @see self::_send_sftp_packet()
|
||||||
*/
|
*/
|
||||||
private $use_request_id = false;
|
private bool $use_request_id = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Packet Type
|
* The Packet Type
|
||||||
@ -116,75 +115,66 @@ class SFTP extends SSH2
|
|||||||
* The request ID exists in the off chance that a packet is sent out-of-order. Of course, this library doesn't support
|
* The request ID exists in the off chance that a packet is sent out-of-order. Of course, this library doesn't support
|
||||||
* concurrent actions, so it's somewhat academic, here.
|
* concurrent actions, so it's somewhat academic, here.
|
||||||
*
|
*
|
||||||
* @var int
|
|
||||||
* @see self::_get_sftp_packet()
|
* @see self::_get_sftp_packet()
|
||||||
*/
|
*/
|
||||||
private $packet_type = -1;
|
private int $packet_type = -1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Packet Buffer
|
* Packet Buffer
|
||||||
*
|
*
|
||||||
* @var string
|
|
||||||
* @see self::_get_sftp_packet()
|
* @see self::_get_sftp_packet()
|
||||||
*/
|
*/
|
||||||
private $packet_buffer = '';
|
private string $packet_buffer = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extensions supported by the server
|
* Extensions supported by the server
|
||||||
*
|
*
|
||||||
* @var array
|
|
||||||
* @see self::_initChannel()
|
* @see self::_initChannel()
|
||||||
*/
|
*/
|
||||||
private $extensions = [];
|
private array $extensions = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Server SFTP version
|
* Server SFTP version
|
||||||
*
|
*
|
||||||
* @var int
|
|
||||||
* @see self::_initChannel()
|
* @see self::_initChannel()
|
||||||
*/
|
*/
|
||||||
private $version;
|
private int $version;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default Server SFTP version
|
* Default Server SFTP version
|
||||||
*
|
*
|
||||||
* @var int
|
|
||||||
* @see self::_initChannel()
|
* @see self::_initChannel()
|
||||||
*/
|
*/
|
||||||
private $defaultVersion;
|
private int $defaultVersion;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Preferred SFTP version
|
* Preferred SFTP version
|
||||||
*
|
*
|
||||||
* @var int
|
|
||||||
* @see self::_initChannel()
|
* @see self::_initChannel()
|
||||||
*/
|
*/
|
||||||
private $preferredVersion = 3;
|
private int $preferredVersion = 3;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Current working directory
|
* Current working directory
|
||||||
*
|
*
|
||||||
* @var string|bool
|
|
||||||
* @see self::realpath()
|
* @see self::realpath()
|
||||||
* @see self::chdir()
|
* @see self::chdir()
|
||||||
*/
|
*/
|
||||||
private $pwd = false;
|
private string|bool $pwd = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Packet Type Log
|
* Packet Type Log
|
||||||
*
|
*
|
||||||
* @see self::getLog()
|
* @see self::getLog()
|
||||||
* @var array
|
|
||||||
*/
|
*/
|
||||||
private $packet_type_log = [];
|
private array $packet_type_log = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Packet Log
|
* Packet Log
|
||||||
*
|
*
|
||||||
* @see self::getLog()
|
* @see self::getLog()
|
||||||
* @var array
|
|
||||||
*/
|
*/
|
||||||
private $packet_log = [];
|
private array $packet_log = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Real-time log file pointer
|
* Real-time log file pointer
|
||||||
@ -198,35 +188,30 @@ class SFTP extends SSH2
|
|||||||
* Real-time log file size
|
* Real-time log file size
|
||||||
*
|
*
|
||||||
* @see self::_append_log()
|
* @see self::_append_log()
|
||||||
* @var int
|
|
||||||
*/
|
*/
|
||||||
private $realtime_log_size;
|
private int $realtime_log_size;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Real-time log file wrap boolean
|
* Real-time log file wrap boolean
|
||||||
*
|
*
|
||||||
* @see self::_append_log()
|
* @see self::_append_log()
|
||||||
* @var bool
|
|
||||||
*/
|
*/
|
||||||
private $realtime_log_wrap;
|
private bool $realtime_log_wrap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Current log size
|
* Current log size
|
||||||
*
|
*
|
||||||
* Should never exceed self::LOG_MAX_SIZE
|
* Should never exceed self::LOG_MAX_SIZE
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
*/
|
*/
|
||||||
private $log_size;
|
private int $log_size;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Error information
|
* Error information
|
||||||
*
|
*
|
||||||
* @see self::getSFTPErrors()
|
* @see self::getSFTPErrors()
|
||||||
* @see self::getLastSFTPError()
|
* @see self::getLastSFTPError()
|
||||||
* @var array
|
|
||||||
*/
|
*/
|
||||||
private $sftp_errors = [];
|
private array $sftp_errors = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stat Cache
|
* Stat Cache
|
||||||
@ -237,36 +222,32 @@ class SFTP extends SSH2
|
|||||||
* @see self::_update_stat_cache()
|
* @see self::_update_stat_cache()
|
||||||
* @see self::_remove_from_stat_cache()
|
* @see self::_remove_from_stat_cache()
|
||||||
* @see self::_query_stat_cache()
|
* @see self::_query_stat_cache()
|
||||||
* @var array
|
|
||||||
*/
|
*/
|
||||||
private $stat_cache = [];
|
private array $stat_cache = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Max SFTP Packet Size
|
* Max SFTP Packet Size
|
||||||
*
|
*
|
||||||
* @see self::__construct()
|
* @see self::__construct()
|
||||||
* @see self::get()
|
* @see self::get()
|
||||||
* @var int
|
|
||||||
*/
|
*/
|
||||||
private $max_sftp_packet;
|
private int $max_sftp_packet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stat Cache Flag
|
* Stat Cache Flag
|
||||||
*
|
*
|
||||||
* @see self::disableStatCache()
|
* @see self::disableStatCache()
|
||||||
* @see self::enableStatCache()
|
* @see self::enableStatCache()
|
||||||
* @var bool
|
|
||||||
*/
|
*/
|
||||||
private $use_stat_cache = true;
|
private bool $use_stat_cache = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort Options
|
* Sort Options
|
||||||
*
|
*
|
||||||
* @see self::_comparator()
|
* @see self::_comparator()
|
||||||
* @see self::setListOrder()
|
* @see self::setListOrder()
|
||||||
* @var array
|
|
||||||
*/
|
*/
|
||||||
protected $sortOptions = [];
|
private array $sortOptions = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Canonicalization Flag
|
* Canonicalization Flag
|
||||||
@ -277,26 +258,23 @@ class SFTP extends SSH2
|
|||||||
* @see self::enablePathCanonicalization()
|
* @see self::enablePathCanonicalization()
|
||||||
* @see self::disablePathCanonicalization()
|
* @see self::disablePathCanonicalization()
|
||||||
* @see self::realpath()
|
* @see self::realpath()
|
||||||
* @var bool
|
|
||||||
*/
|
*/
|
||||||
private $canonicalize_paths = true;
|
private bool $canonicalize_paths = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Request Buffers
|
* Request Buffers
|
||||||
*
|
*
|
||||||
* @see self::_get_sftp_packet()
|
* @see self::_get_sftp_packet()
|
||||||
* @var array
|
|
||||||
*/
|
*/
|
||||||
private $requestBuffer = [];
|
private array $requestBuffer = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Preserve timestamps on file downloads / uploads
|
* Preserve timestamps on file downloads / uploads
|
||||||
*
|
*
|
||||||
* @see self::get()
|
* @see self::get()
|
||||||
* @see self::put()
|
* @see self::put()
|
||||||
* @var bool
|
|
||||||
*/
|
*/
|
||||||
private $preserveTime = false;
|
private bool $preserveTime = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Arbitrary Length Packets Flag
|
* Arbitrary Length Packets Flag
|
||||||
@ -308,30 +286,24 @@ class SFTP extends SSH2
|
|||||||
*
|
*
|
||||||
* @see self::enableArbitraryLengthPackets()
|
* @see self::enableArbitraryLengthPackets()
|
||||||
* @see self::_get_sftp_packet()
|
* @see self::_get_sftp_packet()
|
||||||
* @var bool
|
|
||||||
*/
|
*/
|
||||||
private $allow_arbitrary_length_packets = false;
|
private bool $allow_arbitrary_length_packets = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Was the last packet due to the channels being closed or not?
|
* Was the last packet due to the channels being closed or not?
|
||||||
*
|
*
|
||||||
* @see self::get()
|
* @see self::get()
|
||||||
* @see self::get_sftp_packet()
|
* @see self::get_sftp_packet()
|
||||||
* @var bool
|
|
||||||
*/
|
*/
|
||||||
private $channel_close = false;
|
private bool $channel_close = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Has the SFTP channel been partially negotiated?
|
* Has the SFTP channel been partially negotiated?
|
||||||
*
|
|
||||||
* @var bool
|
|
||||||
*/
|
*/
|
||||||
private $partial_init = false;
|
private bool $partial_init = false;
|
||||||
|
|
||||||
/** @var int */
|
private int $queueSize = 32;
|
||||||
private $queueSize = 32;
|
private int $uploadQueueSize = 1024;
|
||||||
/** @var int */
|
|
||||||
private $uploadQueueSize = 1024;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default Constructor.
|
* Default Constructor.
|
||||||
|
@ -33,59 +33,43 @@ class Stream
|
|||||||
* SFTP instances
|
* SFTP instances
|
||||||
*
|
*
|
||||||
* Rather than re-create the connection we re-use instances if possible
|
* Rather than re-create the connection we re-use instances if possible
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
*/
|
||||||
public static $instances;
|
public static array $instances;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SFTP instance
|
* SFTP instance
|
||||||
*
|
|
||||||
* @var object
|
|
||||||
*/
|
*/
|
||||||
private $sftp;
|
private SFTP $sftp;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Path
|
* Path
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
*/
|
||||||
private $path;
|
private string $path;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mode
|
* Mode
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
*/
|
||||||
private $mode;
|
private string $mode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Position
|
* Position
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
*/
|
*/
|
||||||
private $pos;
|
private int $pos;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Size
|
* Size
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
*/
|
*/
|
||||||
private $size;
|
private int|false $size;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Directory entries
|
* Directory entries
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
*/
|
||||||
private $entries;
|
private array $entries;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* EOF flag
|
* EOF flag
|
||||||
*
|
|
||||||
* @var bool
|
|
||||||
*/
|
*/
|
||||||
private $eof;
|
private bool $eof;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Context resource
|
* Context resource
|
||||||
@ -165,7 +149,7 @@ class Stream
|
|||||||
|
|
||||||
if (preg_match('/^{[a-z0-9]+}$/i', $host)) {
|
if (preg_match('/^{[a-z0-9]+}$/i', $host)) {
|
||||||
$host = SSH2::getConnectionByResourceId($host);
|
$host = SSH2::getConnectionByResourceId($host);
|
||||||
if ($host === false) {
|
if ($host === null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$this->sftp = $host;
|
$this->sftp = $host;
|
||||||
|
@ -192,10 +192,8 @@ class SSH2
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The SSH identifier
|
* The SSH identifier
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
*/
|
||||||
private $identifier;
|
private string $identifier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Socket Object
|
* The Socket Object
|
||||||
@ -209,147 +207,124 @@ class SSH2
|
|||||||
*
|
*
|
||||||
* The bits that are set represent functions that have been called already. This is used to determine
|
* The bits that are set represent functions that have been called already. This is used to determine
|
||||||
* if a requisite function has been successfully executed. If not, an error should be thrown.
|
* if a requisite function has been successfully executed. If not, an error should be thrown.
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
*/
|
*/
|
||||||
protected $bitmap = 0;
|
protected int $bitmap = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Error information
|
* Error information
|
||||||
*
|
*
|
||||||
* @see self::getErrors()
|
* @see self::getErrors()
|
||||||
* @see self::getLastError()
|
* @see self::getLastError()
|
||||||
* @var array
|
|
||||||
*/
|
*/
|
||||||
private $errors = [];
|
private array $errors = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Server Identifier
|
* Server Identifier
|
||||||
*
|
*
|
||||||
* @see self::getServerIdentification()
|
* @see self::getServerIdentification()
|
||||||
* @var string|false
|
|
||||||
*/
|
*/
|
||||||
protected $server_identifier = false;
|
protected string|false $server_identifier = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Key Exchange Algorithms
|
* Key Exchange Algorithms
|
||||||
*
|
*
|
||||||
* @see self::getKexAlgorithims()
|
* @see self::getKexAlgorithims()
|
||||||
* @var array|false
|
|
||||||
*/
|
*/
|
||||||
private $kex_algorithms = false;
|
private array|false $kex_algorithms = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Key Exchange Algorithm
|
* Key Exchange Algorithm
|
||||||
*
|
*
|
||||||
* @see self::getMethodsNegotiated()
|
* @see self::getMethodsNegotiated()
|
||||||
* @var string|false
|
|
||||||
*/
|
*/
|
||||||
private $kex_algorithm = false;
|
private string|false $kex_algorithm = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Minimum Diffie-Hellman Group Bit Size in RFC 4419 Key Exchange Methods
|
* Minimum Diffie-Hellman Group Bit Size in RFC 4419 Key Exchange Methods
|
||||||
*
|
*
|
||||||
* @see self::_key_exchange()
|
* @see self::_key_exchange()
|
||||||
* @var int
|
|
||||||
*/
|
*/
|
||||||
private $kex_dh_group_size_min = 1536;
|
private int $kex_dh_group_size_min = 1536;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Preferred Diffie-Hellman Group Bit Size in RFC 4419 Key Exchange Methods
|
* Preferred Diffie-Hellman Group Bit Size in RFC 4419 Key Exchange Methods
|
||||||
*
|
*
|
||||||
* @see self::_key_exchange()
|
* @see self::_key_exchange()
|
||||||
* @var int
|
|
||||||
*/
|
*/
|
||||||
private $kex_dh_group_size_preferred = 2048;
|
private int $kex_dh_group_size_preferred = 2048;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maximum Diffie-Hellman Group Bit Size in RFC 4419 Key Exchange Methods
|
* Maximum Diffie-Hellman Group Bit Size in RFC 4419 Key Exchange Methods
|
||||||
*
|
*
|
||||||
* @see self::_key_exchange()
|
* @see self::_key_exchange()
|
||||||
* @var int
|
|
||||||
*/
|
*/
|
||||||
private $kex_dh_group_size_max = 4096;
|
private int $kex_dh_group_size_max = 4096;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Server Host Key Algorithms
|
* Server Host Key Algorithms
|
||||||
*
|
*
|
||||||
* @see self::getServerHostKeyAlgorithms()
|
* @see self::getServerHostKeyAlgorithms()
|
||||||
* @var array|false
|
|
||||||
*/
|
*/
|
||||||
private $server_host_key_algorithms = false;
|
private array|false $server_host_key_algorithms = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Encryption Algorithms: Client to Server
|
* Encryption Algorithms: Client to Server
|
||||||
*
|
*
|
||||||
* @see self::getEncryptionAlgorithmsClient2Server()
|
* @see self::getEncryptionAlgorithmsClient2Server()
|
||||||
* @var array|false
|
|
||||||
*/
|
*/
|
||||||
private $encryption_algorithms_client_to_server = false;
|
private array|false $encryption_algorithms_client_to_server = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Encryption Algorithms: Server to Client
|
* Encryption Algorithms: Server to Client
|
||||||
*
|
*
|
||||||
* @see self::getEncryptionAlgorithmsServer2Client()
|
* @see self::getEncryptionAlgorithmsServer2Client()
|
||||||
* @var array|false
|
|
||||||
*/
|
*/
|
||||||
private $encryption_algorithms_server_to_client = false;
|
private array|false $encryption_algorithms_server_to_client = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MAC Algorithms: Client to Server
|
* MAC Algorithms: Client to Server
|
||||||
*
|
*
|
||||||
* @see self::getMACAlgorithmsClient2Server()
|
* @see self::getMACAlgorithmsClient2Server()
|
||||||
* @var array|false
|
|
||||||
*/
|
*/
|
||||||
private $mac_algorithms_client_to_server = false;
|
private array|false $mac_algorithms_client_to_server = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MAC Algorithms: Server to Client
|
* MAC Algorithms: Server to Client
|
||||||
*
|
*
|
||||||
* @see self::getMACAlgorithmsServer2Client()
|
* @see self::getMACAlgorithmsServer2Client()
|
||||||
* @var array|false
|
|
||||||
*/
|
*/
|
||||||
private $mac_algorithms_server_to_client = false;
|
private array|false $mac_algorithms_server_to_client = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compression Algorithms: Client to Server
|
* Compression Algorithms: Client to Server
|
||||||
*
|
*
|
||||||
* @see self::getCompressionAlgorithmsClient2Server()
|
* @see self::getCompressionAlgorithmsClient2Server()
|
||||||
* @var array|false
|
|
||||||
*/
|
*/
|
||||||
private $compression_algorithms_client_to_server = false;
|
private array|false $compression_algorithms_client_to_server = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compression Algorithms: Server to Client
|
* Compression Algorithms: Server to Client
|
||||||
*
|
*
|
||||||
* @see self::getCompressionAlgorithmsServer2Client()
|
* @see self::getCompressionAlgorithmsServer2Client()
|
||||||
* @var array|false
|
|
||||||
*/
|
*/
|
||||||
private $compression_algorithms_server_to_client = false;
|
private array|false $compression_algorithms_server_to_client = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Languages: Server to Client
|
* Languages: Server to Client
|
||||||
*
|
|
||||||
* @see self::getLanguagesServer2Client()
|
|
||||||
* @var array|false
|
|
||||||
*/
|
*/
|
||||||
private $languages_server_to_client = false;
|
private array|false $languages_server_to_client = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Languages: Client to Server
|
* Languages: Client to Server
|
||||||
*
|
|
||||||
* @see self::getLanguagesClient2Server()
|
|
||||||
* @var array|false
|
|
||||||
*/
|
*/
|
||||||
private $languages_client_to_server = false;
|
private array|false $languages_client_to_server = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Preferred Algorithms
|
* Preferred Algorithms
|
||||||
*
|
*
|
||||||
* @see self::setPreferredAlgorithms()
|
* @see self::setPreferredAlgorithms()
|
||||||
* @var array
|
|
||||||
*/
|
*/
|
||||||
private $preferred = [];
|
private array $preferred = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Block Size for Server to Client Encryption
|
* Block Size for Server to Client Encryption
|
||||||
@ -362,145 +337,117 @@ class SSH2
|
|||||||
* -- http://tools.ietf.org/html/rfc4253#section-6
|
* -- http://tools.ietf.org/html/rfc4253#section-6
|
||||||
*
|
*
|
||||||
* @see self::__construct()
|
* @see self::__construct()
|
||||||
* @see self::_send_binary_packet()
|
* @see self::send_binary_packet()
|
||||||
* @var int
|
|
||||||
*/
|
*/
|
||||||
private $encrypt_block_size = 8;
|
private int $encrypt_block_size = 8;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Block Size for Client to Server Encryption
|
* Block Size for Client to Server Encryption
|
||||||
*
|
*
|
||||||
* @see self::__construct()
|
* @see self::__construct()
|
||||||
* @see self::_get_binary_packet()
|
* @see self::get_binary_packet()
|
||||||
* @var int
|
|
||||||
*/
|
*/
|
||||||
private $decrypt_block_size = 8;
|
private int $decrypt_block_size = 8;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Server to Client Encryption Object
|
* Server to Client Encryption Object
|
||||||
*
|
*
|
||||||
* @see self::_get_binary_packet()
|
* @see self::get_binary_packet()
|
||||||
* @var SymmetricKey|false
|
|
||||||
*/
|
*/
|
||||||
private $decrypt = false;
|
private SymmetricKey|false $decrypt = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decryption Algorithm Name
|
* Decryption Algorithm Name
|
||||||
*
|
|
||||||
* @var string|null
|
|
||||||
*/
|
*/
|
||||||
private $decryptName;
|
private string|null $decryptName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decryption Invocation Counter
|
* Decryption Invocation Counter
|
||||||
*
|
*
|
||||||
* Used by GCM
|
* Used by GCM
|
||||||
*
|
|
||||||
* @var string|null
|
|
||||||
*/
|
*/
|
||||||
private $decryptInvocationCounter;
|
private string|null $decryptInvocationCounter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fixed Part of Nonce
|
* Fixed Part of Nonce
|
||||||
*
|
*
|
||||||
* Used by GCM
|
* Used by GCM
|
||||||
*
|
|
||||||
* @var string|null
|
|
||||||
*/
|
*/
|
||||||
private $decryptFixedPart;
|
private string|null $decryptFixedPart;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Server to Client Length Encryption Object
|
* Server to Client Length Encryption Object
|
||||||
*
|
*
|
||||||
* @see self::_get_binary_packet()
|
* @see self::get_binary_packet()
|
||||||
* @var object
|
|
||||||
*/
|
*/
|
||||||
private $lengthDecrypt = false;
|
private SymmetricKey|false $lengthDecrypt = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Client to Server Encryption Object
|
* Client to Server Encryption Object
|
||||||
*
|
*
|
||||||
* @see self::_send_binary_packet()
|
* @see self::send_binary_packet()
|
||||||
* @var SymmetricKey|false
|
|
||||||
*/
|
*/
|
||||||
private $encrypt = false;
|
private SymmetricKey|false $encrypt = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Encryption Algorithm Name
|
* Encryption Algorithm Name
|
||||||
*
|
|
||||||
* @var string|null
|
|
||||||
*/
|
*/
|
||||||
private $encryptName;
|
private string|null $encryptName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Encryption Invocation Counter
|
* Encryption Invocation Counter
|
||||||
*
|
*
|
||||||
* Used by GCM
|
* Used by GCM
|
||||||
*
|
|
||||||
* @var string|null
|
|
||||||
*/
|
*/
|
||||||
private $encryptInvocationCounter;
|
private string|null $encryptInvocationCounter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fixed Part of Nonce
|
* Fixed Part of Nonce
|
||||||
*
|
*
|
||||||
* Used by GCM
|
* Used by GCM
|
||||||
*
|
|
||||||
* @var string|null
|
|
||||||
*/
|
*/
|
||||||
private $encryptFixedPart;
|
private string|null $encryptFixedPart;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Client to Server Length Encryption Object
|
* Client to Server Length Encryption Object
|
||||||
*
|
*
|
||||||
* @see self::_send_binary_packet()
|
* @see self::send_binary_packet()
|
||||||
* @var object
|
|
||||||
*/
|
*/
|
||||||
private $lengthEncrypt = false;
|
private SymmetricKey|false $lengthEncrypt = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Client to Server HMAC Object
|
* Client to Server HMAC Object
|
||||||
*
|
*
|
||||||
* @see self::_send_binary_packet()
|
* @see self::send_binary_packet()
|
||||||
* @var object
|
|
||||||
*/
|
*/
|
||||||
private $hmac_create = false;
|
private Hash|\stdClass|false $hmac_create = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Client to Server HMAC Name
|
* Client to Server HMAC Name
|
||||||
*
|
|
||||||
* @var string|false
|
|
||||||
*/
|
*/
|
||||||
private $hmac_create_name;
|
private string|false $hmac_create_name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Client to Server ETM
|
* Client to Server ETM
|
||||||
*
|
|
||||||
* @var int|false
|
|
||||||
*/
|
*/
|
||||||
private $hmac_create_etm;
|
private int|false $hmac_create_etm;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Server to Client HMAC Object
|
* Server to Client HMAC Object
|
||||||
*
|
*
|
||||||
* @see self::_get_binary_packet()
|
* @see self::get_binary_packet()
|
||||||
* @var object
|
|
||||||
*/
|
*/
|
||||||
private $hmac_check = false;
|
private Hash|\stdClass|false $hmac_check = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Server to Client HMAC Name
|
* Server to Client HMAC Name
|
||||||
*
|
|
||||||
* @var string|false
|
|
||||||
*/
|
*/
|
||||||
private $hmac_check_name;
|
private string|false $hmac_check_name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Server to Client ETM
|
* Server to Client ETM
|
||||||
*
|
|
||||||
* @var int|false
|
|
||||||
*/
|
*/
|
||||||
private $hmac_check_etm;
|
private int|false $hmac_check_etm;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Size of server to client HMAC
|
* Size of server to client HMAC
|
||||||
@ -509,18 +456,16 @@ class SSH2
|
|||||||
* For the client to server side, the HMAC object will make the HMAC as long as it needs to be. All we need to do is
|
* For the client to server side, the HMAC object will make the HMAC as long as it needs to be. All we need to do is
|
||||||
* append it.
|
* append it.
|
||||||
*
|
*
|
||||||
* @see self::_get_binary_packet()
|
* @see self::get_binary_packet()
|
||||||
* @var int
|
|
||||||
*/
|
*/
|
||||||
private $hmac_size = false;
|
private int|false $hmac_size = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Server Public Host Key
|
* Server Public Host Key
|
||||||
*
|
*
|
||||||
* @see self::getServerPublicHostKey()
|
* @see self::getServerPublicHostKey()
|
||||||
* @var string
|
|
||||||
*/
|
*/
|
||||||
private $server_public_host_key;
|
private string $server_public_host_key;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Session identifier
|
* Session identifier
|
||||||
@ -531,40 +476,36 @@ class SSH2
|
|||||||
*
|
*
|
||||||
* -- http://tools.ietf.org/html/rfc4253#section-7.2
|
* -- http://tools.ietf.org/html/rfc4253#section-7.2
|
||||||
*
|
*
|
||||||
* @see self::_key_exchange()
|
* @see self::key_exchange()
|
||||||
* @var string
|
|
||||||
*/
|
*/
|
||||||
private $session_id = false;
|
private string|false $session_id = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exchange hash
|
* Exchange hash
|
||||||
*
|
*
|
||||||
* The current exchange hash
|
* The current exchange hash
|
||||||
*
|
*
|
||||||
* @see self::_key_exchange()
|
* @see self::key_exchange()
|
||||||
* @var string
|
|
||||||
*/
|
*/
|
||||||
private $exchange_hash = false;
|
private string|false $exchange_hash = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send Sequence Number
|
* Send Sequence Number
|
||||||
*
|
*
|
||||||
* See 'Section 6.4. Data Integrity' of rfc4253 for more info.
|
* See 'Section 6.4. Data Integrity' of rfc4253 for more info.
|
||||||
*
|
*
|
||||||
* @see self::_send_binary_packet()
|
* @see self::send_binary_packet()
|
||||||
* @var int
|
|
||||||
*/
|
*/
|
||||||
private $send_seq_no = 0;
|
private int $send_seq_no = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Sequence Number
|
* Get Sequence Number
|
||||||
*
|
*
|
||||||
* See 'Section 6.4. Data Integrity' of rfc4253 for more info.
|
* See 'Section 6.4. Data Integrity' of rfc4253 for more info.
|
||||||
*
|
*
|
||||||
* @see self::_get_binary_packet()
|
* @see self::get_binary_packet()
|
||||||
* @var int
|
|
||||||
*/
|
*/
|
||||||
private $get_seq_no = 0;
|
private int $get_seq_no = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Server Channels
|
* Server Channels
|
||||||
@ -573,9 +514,8 @@ class SSH2
|
|||||||
*
|
*
|
||||||
* @see self::get_channel_packet()
|
* @see self::get_channel_packet()
|
||||||
* @see self::exec()
|
* @see self::exec()
|
||||||
* @var array
|
|
||||||
*/
|
*/
|
||||||
protected $server_channels = [];
|
protected array $server_channels = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Channel Buffers
|
* Channel Buffers
|
||||||
@ -585,9 +525,8 @@ class SSH2
|
|||||||
*
|
*
|
||||||
* @see self::get_channel_packet()
|
* @see self::get_channel_packet()
|
||||||
* @see self::exec()
|
* @see self::exec()
|
||||||
* @var array
|
|
||||||
*/
|
*/
|
||||||
private $channel_buffers = [];
|
private array $channel_buffers = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Channel Status
|
* Channel Status
|
||||||
@ -595,9 +534,8 @@ class SSH2
|
|||||||
* Contains the type of the last sent message
|
* Contains the type of the last sent message
|
||||||
*
|
*
|
||||||
* @see self::get_channel_packet()
|
* @see self::get_channel_packet()
|
||||||
* @var array
|
|
||||||
*/
|
*/
|
||||||
protected $channel_status = [];
|
protected array $channel_status = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Packet Size
|
* Packet Size
|
||||||
@ -605,36 +543,32 @@ class SSH2
|
|||||||
* Maximum packet size indexed by channel
|
* Maximum packet size indexed by channel
|
||||||
*
|
*
|
||||||
* @see self::send_channel_packet()
|
* @see self::send_channel_packet()
|
||||||
* @var array
|
|
||||||
*/
|
*/
|
||||||
private $packet_size_client_to_server = [];
|
private array $packet_size_client_to_server = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Message Number Log
|
* Message Number Log
|
||||||
*
|
*
|
||||||
* @see self::getLog()
|
* @see self::getLog()
|
||||||
* @var array
|
|
||||||
*/
|
*/
|
||||||
private $message_number_log = [];
|
private array $message_number_log = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Message Log
|
* Message Log
|
||||||
*
|
*
|
||||||
* @see self::getLog()
|
* @see self::getLog()
|
||||||
* @var array
|
|
||||||
*/
|
*/
|
||||||
private $message_log = [];
|
private array $message_log = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Window Size
|
* The Window Size
|
||||||
*
|
*
|
||||||
* Bytes the other party can send before it must wait for the window to be adjusted (0x7FFFFFFF = 2GB)
|
* Bytes the other party can send before it must wait for the window to be adjusted (0x7FFFFFFF = 2GB)
|
||||||
*
|
*
|
||||||
* @var int
|
|
||||||
* @see self::send_channel_packet()
|
* @see self::send_channel_packet()
|
||||||
* @see self::exec()
|
* @see self::exec()
|
||||||
*/
|
*/
|
||||||
protected $window_size = 0x7FFFFFFF;
|
protected int $window_size = 0x7FFFFFFF;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* What we resize the window to
|
* What we resize the window to
|
||||||
@ -643,11 +577,10 @@ class SSH2
|
|||||||
* Some SFTP clients (GoAnywhere) don't support adding 0x7FFFFFFF to the window size after the fact so
|
* Some SFTP clients (GoAnywhere) don't support adding 0x7FFFFFFF to the window size after the fact so
|
||||||
* we'll just do what PuTTY does
|
* we'll just do what PuTTY does
|
||||||
*
|
*
|
||||||
* @var int
|
|
||||||
* @see self::_send_channel_packet()
|
* @see self::_send_channel_packet()
|
||||||
* @see self::exec()
|
* @see self::exec()
|
||||||
*/
|
*/
|
||||||
private $window_resize = 0x40000000;
|
private int $window_resize = 0x40000000;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Window size, server to client
|
* Window size, server to client
|
||||||
@ -655,9 +588,8 @@ class SSH2
|
|||||||
* Window size indexed by channel
|
* Window size indexed by channel
|
||||||
*
|
*
|
||||||
* @see self::send_channel_packet()
|
* @see self::send_channel_packet()
|
||||||
* @var array
|
|
||||||
*/
|
*/
|
||||||
protected $window_size_server_to_client = [];
|
protected array $window_size_server_to_client = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Window size, client to server
|
* Window size, client to server
|
||||||
@ -665,9 +597,8 @@ class SSH2
|
|||||||
* Window size indexed by channel
|
* Window size indexed by channel
|
||||||
*
|
*
|
||||||
* @see self::get_channel_packet()
|
* @see self::get_channel_packet()
|
||||||
* @var array
|
|
||||||
*/
|
*/
|
||||||
private $window_size_client_to_server = [];
|
private array $window_size_client_to_server = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Server signature
|
* Server signature
|
||||||
@ -675,9 +606,8 @@ class SSH2
|
|||||||
* Verified against $this->session_id
|
* Verified against $this->session_id
|
||||||
*
|
*
|
||||||
* @see self::getServerPublicHostKey()
|
* @see self::getServerPublicHostKey()
|
||||||
* @var string
|
|
||||||
*/
|
*/
|
||||||
private $signature = '';
|
private string $signature = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Server signature format
|
* Server signature format
|
||||||
@ -685,17 +615,15 @@ class SSH2
|
|||||||
* ssh-rsa or ssh-dss.
|
* ssh-rsa or ssh-dss.
|
||||||
*
|
*
|
||||||
* @see self::getServerPublicHostKey()
|
* @see self::getServerPublicHostKey()
|
||||||
* @var string
|
|
||||||
*/
|
*/
|
||||||
private $signature_format = '';
|
private string $signature_format = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interactive Buffer
|
* Interactive Buffer
|
||||||
*
|
*
|
||||||
* @see self::read()
|
* @see self::read()
|
||||||
* @var string
|
|
||||||
*/
|
*/
|
||||||
private $interactiveBuffer = '';
|
private string $interactiveBuffer = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Current log size
|
* Current log size
|
||||||
@ -704,32 +632,29 @@ class SSH2
|
|||||||
*
|
*
|
||||||
* @see self::_send_binary_packet()
|
* @see self::_send_binary_packet()
|
||||||
* @see self::_get_binary_packet()
|
* @see self::_get_binary_packet()
|
||||||
* @var int
|
|
||||||
*/
|
*/
|
||||||
private $log_size;
|
private int $log_size;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Timeout
|
* Timeout
|
||||||
*
|
*
|
||||||
* @see SSH2::setTimeout()
|
* @see SSH2::setTimeout()
|
||||||
* @var int
|
|
||||||
*/
|
*/
|
||||||
protected $timeout;
|
protected int|null $timeout = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Current Timeout
|
* Current Timeout
|
||||||
*
|
*
|
||||||
* @see SSH2::get_channel_packet()
|
* @see SSH2::get_channel_packet()
|
||||||
* @var int
|
|
||||||
*/
|
*/
|
||||||
protected $curTimeout;
|
protected int|float|null $curTimeout = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Keep Alive Interval
|
* Keep Alive Interval
|
||||||
*
|
*
|
||||||
* @see self::setKeepAlive()
|
* @see self::setKeepAlive()
|
||||||
*/
|
*/
|
||||||
private $keepAlive;
|
private int|null $keepAlive = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Real-time log file pointer
|
* Real-time log file pointer
|
||||||
@ -743,91 +668,75 @@ class SSH2
|
|||||||
* Real-time log file size
|
* Real-time log file size
|
||||||
*
|
*
|
||||||
* @see self::_append_log()
|
* @see self::_append_log()
|
||||||
* @var int
|
|
||||||
*/
|
*/
|
||||||
private $realtime_log_size;
|
private int $realtime_log_size;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Has the signature been validated?
|
* Has the signature been validated?
|
||||||
*
|
*
|
||||||
* @see self::getServerPublicHostKey()
|
* @see self::getServerPublicHostKey()
|
||||||
* @var bool
|
|
||||||
*/
|
*/
|
||||||
private $signature_validated = false;
|
private bool $signature_validated = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Real-time log file wrap boolean
|
* Real-time log file wrap boolean
|
||||||
*
|
*
|
||||||
* @see self::_append_log()
|
* @see self::_append_log()
|
||||||
* @var bool
|
|
||||||
*/
|
*/
|
||||||
private $realtime_log_wrap;
|
private bool $realtime_log_wrap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flag to suppress stderr from output
|
* Flag to suppress stderr from output
|
||||||
*
|
*
|
||||||
* @see self::enableQuietMode()
|
* @see self::enableQuietMode()
|
||||||
*/
|
*/
|
||||||
private $quiet_mode = false;
|
private bool $quiet_mode = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Time of first network activity
|
* Time of first network activity
|
||||||
*
|
|
||||||
* @var float
|
|
||||||
*/
|
*/
|
||||||
private $last_packet;
|
private float $last_packet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exit status returned from ssh if any
|
* Exit status returned from ssh if any
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
*/
|
*/
|
||||||
private $exit_status;
|
private int|null $exit_status = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flag to request a PTY when using exec()
|
* Flag to request a PTY when using exec()
|
||||||
*
|
*
|
||||||
* @var bool
|
|
||||||
* @see self::enablePTY()
|
* @see self::enablePTY()
|
||||||
*/
|
*/
|
||||||
private $request_pty = false;
|
private bool $request_pty = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flag set while exec() is running when using enablePTY()
|
* Flag set while exec() is running when using enablePTY()
|
||||||
*
|
|
||||||
* @var bool
|
|
||||||
*/
|
*/
|
||||||
private $in_request_pty_exec = false;
|
private bool $in_request_pty_exec = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flag set after startSubsystem() is called
|
* Flag set after startSubsystem() is called
|
||||||
*
|
|
||||||
* @var bool
|
|
||||||
*/
|
*/
|
||||||
private $in_subsystem;
|
private bool $in_subsystem = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contents of stdError
|
* Contents of stdError
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
*/
|
||||||
private $stdErrorLog;
|
private string $stdErrorLog;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Last Interactive Response
|
* The Last Interactive Response
|
||||||
*
|
*
|
||||||
* @see self::_keyboard_interactive_process()
|
* @see self::_keyboard_interactive_process()
|
||||||
* @var string
|
|
||||||
*/
|
*/
|
||||||
private $last_interactive_response = '';
|
private string $last_interactive_response = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Keyboard Interactive Request / Responses
|
* Keyboard Interactive Request / Responses
|
||||||
*
|
*
|
||||||
* @see self::_keyboard_interactive_process()
|
* @see self::_keyboard_interactive_process()
|
||||||
* @var array
|
|
||||||
*/
|
*/
|
||||||
private $keyboard_requests_responses = [];
|
private array $keyboard_requests_responses = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Banner Message
|
* Banner Message
|
||||||
@ -837,59 +746,52 @@ class SSH2
|
|||||||
*
|
*
|
||||||
* @see self::_filter()
|
* @see self::_filter()
|
||||||
* @see self::getBannerMessage()
|
* @see self::getBannerMessage()
|
||||||
* @var string
|
|
||||||
*/
|
*/
|
||||||
private $banner_message = '';
|
private string $banner_message = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Did read() timeout or return normally?
|
* Did read() timeout or return normally?
|
||||||
*
|
*
|
||||||
* @see self::isTimeout()
|
* @see self::isTimeout()
|
||||||
* @var bool
|
|
||||||
*/
|
*/
|
||||||
private $is_timeout = false;
|
private bool $is_timeout = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Log Boundary
|
* Log Boundary
|
||||||
*
|
*
|
||||||
* @see self::_format_log()
|
* @see self::_format_log()
|
||||||
* @var string
|
|
||||||
*/
|
*/
|
||||||
private $log_boundary = ':';
|
private string $log_boundary = ':';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Log Long Width
|
* Log Long Width
|
||||||
*
|
*
|
||||||
* @see self::_format_log()
|
* @see self::_format_log()
|
||||||
* @var int
|
|
||||||
*/
|
*/
|
||||||
private $log_long_width = 65;
|
private int $log_long_width = 65;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Log Short Width
|
* Log Short Width
|
||||||
*
|
*
|
||||||
* @see self::_format_log()
|
* @see self::_format_log()
|
||||||
* @var int
|
|
||||||
*/
|
*/
|
||||||
private $log_short_width = 16;
|
private int $log_short_width = 16;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hostname
|
* Hostname
|
||||||
*
|
*
|
||||||
* @see self::__construct()
|
* @see self::__construct()
|
||||||
* @see self::_connect()
|
* @see self::_connect()
|
||||||
* @var string
|
|
||||||
*/
|
*/
|
||||||
private $host;
|
private string $host;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Port Number
|
* Port Number
|
||||||
*
|
*
|
||||||
* @see self::__construct()
|
* @see self::__construct()
|
||||||
* @see self::_connect()
|
* @see self::connect()
|
||||||
* @var int
|
|
||||||
*/
|
*/
|
||||||
private $port;
|
private int $port;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Number of columns for terminal window size
|
* Number of columns for terminal window size
|
||||||
@ -897,9 +799,8 @@ class SSH2
|
|||||||
* @see self::getWindowColumns()
|
* @see self::getWindowColumns()
|
||||||
* @see self::setWindowColumns()
|
* @see self::setWindowColumns()
|
||||||
* @see self::setWindowSize()
|
* @see self::setWindowSize()
|
||||||
* @var int
|
|
||||||
*/
|
*/
|
||||||
private $windowColumns = 80;
|
private int $windowColumns = 80;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Number of columns for terminal window size
|
* Number of columns for terminal window size
|
||||||
@ -907,111 +808,81 @@ class SSH2
|
|||||||
* @see self::getWindowRows()
|
* @see self::getWindowRows()
|
||||||
* @see self::setWindowRows()
|
* @see self::setWindowRows()
|
||||||
* @see self::setWindowSize()
|
* @see self::setWindowSize()
|
||||||
* @var int
|
|
||||||
*/
|
*/
|
||||||
private $windowRows = 24;
|
private int $windowRows = 24;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Crypto Engine
|
* Crypto Engine
|
||||||
*
|
*
|
||||||
* @see self::setCryptoEngine()
|
* @see self::setCryptoEngine()
|
||||||
* @see self::_key_exchange()
|
* @see self::_key_exchange()
|
||||||
* @var int
|
|
||||||
*/
|
*/
|
||||||
private static $crypto_engine = false;
|
private static int|false $crypto_engine = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A System_SSH_Agent for use in the SSH2 Agent Forwarding scenario
|
* A System_SSH_Agent for use in the SSH2 Agent Forwarding scenario
|
||||||
*
|
|
||||||
* @var Agent
|
|
||||||
*/
|
*/
|
||||||
private $agent;
|
private Agent $agent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Connection storage to replicates ssh2 extension functionality:
|
* Connection storage to replicates ssh2 extension functionality:
|
||||||
* {@link http://php.net/manual/en/wrappers.ssh2.php#refsect1-wrappers.ssh2-examples}
|
* {@link http://php.net/manual/en/wrappers.ssh2.php#refsect1-wrappers.ssh2-examples}
|
||||||
*
|
*
|
||||||
* @var array<string, SSH2|\WeakReference<SSH2>>
|
* @var array<string, \WeakReference<SSH2>>
|
||||||
*/
|
*/
|
||||||
private static $connections;
|
private static array $connections;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send the identification string first?
|
* Send the identification string first?
|
||||||
*
|
|
||||||
* @var bool
|
|
||||||
*/
|
*/
|
||||||
private $send_id_string_first = true;
|
private bool $send_id_string_first = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send the key exchange initiation packet first?
|
* Send the key exchange initiation packet first?
|
||||||
*
|
|
||||||
* @var bool
|
|
||||||
*/
|
*/
|
||||||
private $send_kex_first = true;
|
private bool $send_kex_first = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Some versions of OpenSSH incorrectly calculate the key size
|
* Some versions of OpenSSH incorrectly calculate the key size
|
||||||
*
|
|
||||||
* @var bool
|
|
||||||
*/
|
*/
|
||||||
private $bad_key_size_fix = false;
|
private bool $bad_key_size_fix = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Should we try to re-connect to re-establish keys?
|
* Should we try to re-connect to re-establish keys?
|
||||||
*
|
|
||||||
* @var bool
|
|
||||||
*/
|
*/
|
||||||
private $retry_connect = false;
|
private bool $retry_connect = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Binary Packet Buffer
|
* Binary Packet Buffer
|
||||||
*
|
|
||||||
* @var string|false
|
|
||||||
*/
|
*/
|
||||||
private $binary_packet_buffer = false;
|
private string|false $binary_packet_buffer = false;
|
||||||
|
|
||||||
/**
|
|
||||||
* Preferred Signature Format
|
|
||||||
*
|
|
||||||
* @var string|false
|
|
||||||
*/
|
|
||||||
protected $preferred_signature_format = false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Authentication Credentials
|
* Authentication Credentials
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
*/
|
||||||
protected $auth = [];
|
protected array $auth = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Terminal
|
* Terminal
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
*/
|
||||||
private $term = 'vt100';
|
private string $term = 'vt100';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The authentication methods that may productively continue authentication.
|
* The authentication methods that may productively continue authentication.
|
||||||
*
|
*
|
||||||
* @see https://tools.ietf.org/html/rfc4252#section-5.1
|
* @see https://tools.ietf.org/html/rfc4252#section-5.1
|
||||||
* @var array|null
|
|
||||||
*/
|
*/
|
||||||
private $auth_methods_to_continue = null;
|
private array|null $auth_methods_to_continue = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compression method
|
* Compression method
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
*/
|
*/
|
||||||
private $compress = self::NET_SSH2_COMPRESSION_NONE;
|
private int $compress = self::NET_SSH2_COMPRESSION_NONE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decompression method
|
* Decompression method
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
*/
|
*/
|
||||||
private $decompress = self::NET_SSH2_COMPRESSION_NONE;
|
private int $decompress = self::NET_SSH2_COMPRESSION_NONE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compression context
|
* Compression context
|
||||||
@ -1029,24 +900,18 @@ class SSH2
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Regenerate Compression Context
|
* Regenerate Compression Context
|
||||||
*
|
|
||||||
* @var bool
|
|
||||||
*/
|
*/
|
||||||
private $regenerate_compression_context = false;
|
private bool $regenerate_compression_context = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Regenerate Decompression Context
|
* Regenerate Decompression Context
|
||||||
*
|
|
||||||
* @var bool
|
|
||||||
*/
|
*/
|
||||||
private $regenerate_decompression_context = false;
|
private bool $regenerate_decompression_context = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Smart multi-factor authentication flag
|
* Smart multi-factor authentication flag
|
||||||
*
|
|
||||||
* @var bool
|
|
||||||
*/
|
*/
|
||||||
private $smartMFA = true;
|
private bool $smartMFA = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default Constructor.
|
* Default Constructor.
|
||||||
@ -1057,13 +922,7 @@ class SSH2
|
|||||||
*/
|
*/
|
||||||
public function __construct($host, int $port = 22, int $timeout = 10)
|
public function __construct($host, int $port = 22, int $timeout = 10)
|
||||||
{
|
{
|
||||||
/**
|
self::$connections[$this->getResourceId()] = \WeakReference::create($this);
|
||||||
* Typehint is required due to a bug in Psalm: https://github.com/vimeo/psalm/issues/7508
|
|
||||||
* @var \WeakReference<SSH2>|SSH2
|
|
||||||
*/
|
|
||||||
self::$connections[$this->getResourceId()] = class_exists('WeakReference')
|
|
||||||
? \WeakReference::create($this)
|
|
||||||
: $this;
|
|
||||||
|
|
||||||
if (is_resource($host)) {
|
if (is_resource($host)) {
|
||||||
$this->fsock = $host;
|
$this->fsock = $host;
|
||||||
@ -4787,17 +4646,17 @@ class SSH2
|
|||||||
return '{' . spl_object_hash($this) . '}';
|
return '{' . spl_object_hash($this) . '}';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public static function getConnectionByResourceId(string $id): SSH2|null
|
||||||
* Return existing connection
|
|
||||||
*
|
|
||||||
* @return bool|SSH2 will return false if no such connection
|
|
||||||
*/
|
|
||||||
public static function getConnectionByResourceId(string $id)
|
|
||||||
{
|
{
|
||||||
if (isset(self::$connections[$id])) {
|
if (array_key_exists($id, self::$connections)) {
|
||||||
return self::$connections[$id] instanceof \WeakReference ? self::$connections[$id]->get() : self::$connections[$id];
|
/**
|
||||||
|
* @psalm-ignore-var
|
||||||
|
* @var SSH2|null $ssh2
|
||||||
|
*/
|
||||||
|
$ssh2 = self::$connections[$id]->get();
|
||||||
|
return $ssh2;
|
||||||
}
|
}
|
||||||
return false;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,24 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Bootstrapping File for phpseclib
|
|
||||||
*
|
|
||||||
* composer isn't a requirement for phpseclib 2.0 but this file isn't really required
|
|
||||||
* either. it's a bonus for those using composer but if you're not phpseclib will
|
|
||||||
* still work
|
|
||||||
*
|
|
||||||
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (extension_loaded('mbstring')) {
|
|
||||||
// 2 - MB_OVERLOAD_STRING
|
|
||||||
// mbstring.func_overload is deprecated in php 7.2 and removed in php 8.0.
|
|
||||||
if (version_compare(PHP_VERSION, '8.0.0') < 0 && ini_get('mbstring.func_overload') & 2) {
|
|
||||||
throw new UnexpectedValueException(
|
|
||||||
'Overloading of string functions using mbstring.func_overload ' .
|
|
||||||
'is not supported by phpseclib.'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user