diff --git a/phpseclib/Net/SSH2.php b/phpseclib/Net/SSH2.php index 97a37a0b..b8993075 100644 --- a/phpseclib/Net/SSH2.php +++ b/phpseclib/Net/SSH2.php @@ -3381,7 +3381,9 @@ class SSH2 } $this->channel_status[$channel] = NET_SSH2_MSG_CHANNEL_CLOSE; - return true; + if ($client_channel == $channel) { + return true; + } case NET_SSH2_MSG_CHANNEL_EOF: break; default: diff --git a/tests/Functional/Net/SFTPUserStoryTest.php b/tests/Functional/Net/SFTPUserStoryTest.php index 8830c68d..57524d40 100644 --- a/tests/Functional/Net/SFTPUserStoryTest.php +++ b/tests/Functional/Net/SFTPUserStoryTest.php @@ -710,5 +710,19 @@ class Functional_Net_SFTPUserStoryTest extends PhpseclibFunctionalTestCase $this->assertFalse($sftp->is_writable('nonexistantfile.ext')); $this->assertFalse($sftp->is_writeable('nonexistantfile.ext')); $this->assertFalse($sftp->is_readable('nonexistantfile.ext')); + + return $sftp; + } + + /** + * @depends testReadableWritable + * @group github999 + */ + public function testExecNlist($sftp) + { + $sftp->enablePTY(); + $sftp->exec('ping google.com -c 5'); + sleep(5); + $sftp->nlist(); } }