Browse Source

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
 [] []
Sergei Solovev 1 year ago
parent
commit
ad7df7e0fa
1 changed files with 5 additions and 3 deletions
  1. 5 3
      system/library/ssh.php

+ 5 - 3
system/library/ssh.php

@@ -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');