From e3df33183c78ba212fefec23ebf703452472027e Mon Sep 17 00:00:00 2001 From: terrafrost Date: Sat, 19 Jun 2021 10:14:45 -0500 Subject: [PATCH] SSH2: use weakreference when available to stop memory leak --- phpseclib/Net/SSH2.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpseclib/Net/SSH2.php b/phpseclib/Net/SSH2.php index 7da287af..0ddd4ca7 100644 --- a/phpseclib/Net/SSH2.php +++ b/phpseclib/Net/SSH2.php @@ -1123,7 +1123,7 @@ class SSH2 31 => 'NET_SSH2_MSG_KEX_ECDH_REPLY'] ); - self::$connections[$this->getResourceId()] = $this; + self::$connections[$this->getResourceId()] = class_exists('WeakReference') ? \WeakReference::create($this) : $this; if (is_resource($host)) { $this->fsock = $host;