From e399a320dcaa2c7508645a4ef97f47716b62406e Mon Sep 17 00:00:00 2001 From: terrafrost Date: Mon, 31 Aug 2015 23:36:56 -0500 Subject: [PATCH] SSH/Agent/Identity: replace user_error's with exceptions --- phpseclib/System/SSH/Agent/Identity.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/phpseclib/System/SSH/Agent/Identity.php b/phpseclib/System/SSH/Agent/Identity.php index 490edf6e..82fd224c 100644 --- a/phpseclib/System/SSH/Agent/Identity.php +++ b/phpseclib/System/SSH/Agent/Identity.php @@ -134,6 +134,7 @@ class Identity * * @param String $message * @return String + * @throws \RuntimeException on connection errors * @access public */ function sign($message) @@ -142,13 +143,13 @@ class Identity $packet = pack('CNa*Na*N', Agent::SSH_AGENTC_SIGN_REQUEST, strlen($this->key_blob), $this->key_blob, strlen($message), $message, 0); $packet = pack('Na*', strlen($packet), $packet); if (strlen($packet) != fputs($this->fsock, $packet)) { - user_error('Connection closed during signing'); + throw new \RuntimeException('Connection closed during signing'); } $length = current(unpack('N', fread($this->fsock, 4))); $type = ord(fread($this->fsock, 1)); if ($type != Agent::SSH_AGENT_SIGN_RESPONSE) { - user_error('Unable to retreive signature'); + throw new \RuntimeException('Unable to retreive signature'); } $signature_blob = fread($this->fsock, $length - 1);