From c13231ee1850970a969435951bfff5cf271bc03e Mon Sep 17 00:00:00 2001 From: raffis Date: Thu, 28 Mar 2019 14:41:23 +0100 Subject: [PATCH] fixes #62 --- src/Wrapped/Connection.php | 5 ++--- src/Wrapped/RawConnection.php | 5 +++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Wrapped/Connection.php b/src/Wrapped/Connection.php index 21cafba..17a7742 100644 --- a/src/Wrapped/Connection.php +++ b/src/Wrapped/Connection.php @@ -45,9 +45,8 @@ class Connection extends RawConnection { * @throws ConnectException */ public function clearTillPrompt(): void { - $this->write(''); do { - $promptLine = $this->readLine(); + $promptLine = $this->readLine(6); if ($promptLine === false) { break; } @@ -75,7 +74,7 @@ class Connection extends RawConnection { if (!$this->isValid()) { throw new ConnectionException('Connection not valid'); } - $promptLine = $this->readLine(); //first line is prompt + $promptLine = $this->readLine(6); //first line is prompt if ($promptLine === false) { $this->unknownError($promptLine); } diff --git a/src/Wrapped/RawConnection.php b/src/Wrapped/RawConnection.php index 2985a1e..011472e 100644 --- a/src/Wrapped/RawConnection.php +++ b/src/Wrapped/RawConnection.php @@ -112,10 +112,11 @@ class RawConnection { /** * read a line of output * + * @param int $length * @return string|false */ - public function readLine() { - return stream_get_line($this->getOutputStream(), 4086, "\n"); + public function readLine($length=4086) { + return stream_get_line($this->getOutputStream(), $length, "\n"); } /**