From 13969affae52fafbfe1da1a2423217f841925bb9 Mon Sep 17 00:00:00 2001 From: Frank de Jonge Date: Sat, 9 Mar 2024 16:59:56 +0100 Subject: [PATCH] Keep connection but improve the check --- src/PhpseclibV3/StubSftpConnectionProvider.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/PhpseclibV3/StubSftpConnectionProvider.php b/src/PhpseclibV3/StubSftpConnectionProvider.php index 0e673a7ee..3818b876b 100644 --- a/src/PhpseclibV3/StubSftpConnectionProvider.php +++ b/src/PhpseclibV3/StubSftpConnectionProvider.php @@ -25,13 +25,12 @@ public function disconnect(): void { if ($this->connection) { $this->connection->disconnect(); - $this->connection = null; } } public function provideConnection(): SFTP { - if ( ! $this->connection instanceof SFTP) { + if ( ! $this->connection instanceof SFTP || ! $this->connection->isConnected()) { $connection = new SftpStub($this->host, $this->port); $connection->login($this->username, $this->password);