Fixed a bug when a location was added without a port

[2023-09-03 17:13:20] EngineGP.ERROR: Whoops\Exception\ErrorException: Undefined array key 1 in file /var/www/enginegp/data/www/develop.enginegp.com/system/library/ssh.php on line 20
Stack trace:
  1. Whoops\Exception\ErrorException->() /var/www/enginegp/data/www/develop.enginegp.com/system/library/ssh.php:20
  2. Whoops\Run->handleError() /var/www/enginegp/data/www/develop.enginegp.com/system/library/ssh.php:20
  3. ssh->connect() /var/www/enginegp/data/www/develop.enginegp.com/system/library/ssh.php:12
  4. ssh->auth() /var/www/enginegp/data/www/develop.enginegp.com/system/acp/sections/units/add.php:37
  5. include() /var/www/enginegp/data/www/develop.enginegp.com/system/acp/engine/units.php:32
  6. include() /var/www/enginegp/data/www/develop.enginegp.com/system/acp/distributor.php:63
  7. include() /var/www/enginegp/data/www/develop.enginegp.com/acp/index.php:50
 [] []
This commit is contained in:
Sergei Solovev 2023-09-03 17:17:32 +03:00
parent a45b4fab62
commit ad7df7e0fa

View file

@ -17,10 +17,12 @@ class ssh
public function connect($address)
{
list($host, $port) = explode(':', $address);
if ($port == '')
if (strpos($address, ':') !== false) {
list($host, $port) = explode(':', $address);
} else {
$host = $address;
$port = 22;
}
ini_set('default_socket_timeout', '3');