Skip to content

Commit

Permalink
Upgrade phpseclib to 2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
YOzaz committed Mar 28, 2023
1 parent f6b24bf commit 445dfa6
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 19 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/vendor
/.idea
composer.phar
composer.lock
.DS_Store
Expand Down
11 changes: 8 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
}
],
"require": {
"php": ">=5.4.0",
"php": ">=8.2.0",
"classpreloader/classpreloader": "~1.0.2",
"d11wtq/boris": "~1.0",
"ircmaxell/password-compat": "~1.0",
Expand All @@ -19,7 +19,7 @@
"monolog/monolog": "~1.6",
"nesbot/carbon": "~1.0",
"patchwork/utf8": "~1.1",
"phpseclib/phpseclib": "0.3.*",
"phpseclib/phpseclib": "~2.0",
"predis/predis": "0.8.*",
"stack/builder": "~1.0",
"swiftmailer/swiftmailer": "~5.1",
Expand Down Expand Up @@ -92,5 +92,10 @@
"suggest": {
"doctrine/dbal": "Allow renaming columns and dropping SQLite columns."
},
"minimum-stability": "dev"
"minimum-stability": "dev",
"config": {
"allow-plugins": {
"kylekatarnls/update-helper": true
}
}
}
33 changes: 18 additions & 15 deletions src/Illuminate/Remote/SecLibGateway.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<?php namespace Illuminate\Remote;

use Illuminate\Filesystem\Filesystem;
use Net_SFTP, Crypt_RSA, System_SSH_Agent;
use phpseclib\Net\SFTP;
use phpseclib\Net\SSH2;
use phpseclib\Crypt\RSA;
use phpseclib\System\SSH\Agent;

class SecLibGateway implements GatewayInterface {

Expand Down Expand Up @@ -36,7 +39,7 @@ class SecLibGateway implements GatewayInterface {
/**
* The SecLib connection instance.
*
* @var \Net_SFTP
* @var SFTP
*/
protected $connection;

Expand Down Expand Up @@ -69,7 +72,7 @@ protected function setHostAndPort($host)
}
else
{
list($this->host, $this->port) = explode(':', $host);
[$this->host, $this->port] = explode(':', $host);

$this->port = (int) $this->port;
}
Expand Down Expand Up @@ -139,7 +142,7 @@ public function getString($remote)
*/
public function put($local, $remote)
{
$this->getConnection()->put($remote, $local, NET_SFTP_LOCAL_FILE);
$this->getConnection()->put($remote, $local, SFTP::SOURCE_LOCAL_FILE);
}

/**
Expand All @@ -161,15 +164,15 @@ public function putString($remote, $contents)
*/
public function nextLine()
{
$value = $this->getConnection()->_get_channel_packet(NET_SSH2_CHANNEL_EXEC);
$value = $this->getConnection()->_get_channel_packet(SSH2::CHANNEL_EXEC);

return $value === true ? null : $value;
}

/**
* Get the authentication object for login.
*
* @return \Crypt_RSA|\System_SSH_Agent|string
* @return RSA|Agent|string
* @throws \InvalidArgumentException
*/
protected function getAuthForLogin()
Expand Down Expand Up @@ -211,7 +214,7 @@ protected function hasRsaKey()
* Load the RSA key instance.
*
* @param array $auth
* @return \Crypt_RSA
* @return RSA
*/
protected function loadRsaKey(array $auth)
{
Expand All @@ -237,7 +240,7 @@ protected function readRsaKey(array $auth)
* Create a new RSA key instance.
*
* @param array $auth
* @return \Crypt_RSA
* @return RSA
*/
protected function getKey(array $auth)
{
Expand All @@ -259,21 +262,21 @@ protected function useAgent()
/**
* Get a new SSH Agent instance.
*
* @return \System_SSH_Agent
* @return Agent
*/
public function getAgent()
{
return new System_SSH_Agent;
return new Agent;
}

/**
* Get a new RSA key instance.
*
* @return \Crypt_RSA
* @return RSA
*/
public function getNewKey()
{
return new Crypt_RSA;
return new RSA;
}

/**
Expand Down Expand Up @@ -307,15 +310,15 @@ public function getPort()
}

/**
* Get the underlying Net_SFTP connection.
* Get the underlying SFTP connection.
*
* @return \Net_SFTP
* @return SFTP
*/
public function getConnection()
{
if ($this->connection) return $this->connection;

return $this->connection = new Net_SFTP($this->host, $this->port);
return $this->connection = new SFTP($this->host, $this->port);
}

}
2 changes: 1 addition & 1 deletion src/Illuminate/Remote/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"php": ">=5.4.0",
"illuminate/filesystem": "4.2.*",
"illuminate/support": "4.2.*",
"phpseclib/phpseclib": "0.3.*"
"phpseclib/phpseclib": "~2.0"
},
"require-dev": {
"illuminate/console": "4.2.*"
Expand Down

0 comments on commit 445dfa6

Please sign in to comment.