1
0
mirror of https://github.com/danog/phpseclib.git synced 2024-12-02 17:52:59 +01:00

update exception message

`fputs()` can return `int|false`.  if it fails and `$sent` is `false`, then our exception message looks a little confusing:

> Only  of XXX bytes were sent

This change updates the message to be more descriptive if the `fputs()` fails.
This commit is contained in:
Andrew Brown 2023-04-18 15:16:18 -05:00
parent 8b67d0ac32
commit d4263e854d

View File

@ -4266,7 +4266,8 @@ class SSH2
if (strlen($packet) != $sent) {
$this->bitmap = 0;
throw new \RuntimeException("Only $sent of " . strlen($packet) . " bytes were sent");
$message = $sent === false ? ('Unable to write ' . strlen($packet) . ' bytes') : ("Only $sent of " . strlen($packet) . " bytes were sent");
throw new \RuntimeException($message);
}
}