Merge branch '3.0'

This commit is contained in:
terrafrost 2021-06-19 11:22:26 -05:00
commit 946dedb3e9

View File

@ -4896,7 +4896,10 @@ class SSH2
*/ */
public static function getConnectionByResourceId($id) public static function getConnectionByResourceId($id)
{ {
return isset(self::$connections[$id]) ? self::$connections[$id] : false; if (isset(self::$connections[$id])) {
return self::$connections[$id] instanceof \WeakReference ? self::$connections[$id]->get() : self::$connections[$id];
}
return false;
} }
/** /**
@ -4906,8 +4909,15 @@ class SSH2
*/ */
public static function getConnections() public static function getConnections()
{ {
if (!class_exists('WeakReference')) {
return self::$connections; return self::$connections;
} }
$temp = [];
foreach (self::$connections as $key=>$ref) {
$temp[$key] = $ref->get();
}
return $temp;
}
/* /*
* Update packet types in log history * Update packet types in log history