1
0
mirror of https://github.com/danog/phpseclib.git synced 2024-12-04 18:48:24 +01:00

SSH2: allow for stringable objects

This commit is contained in:
terrafrost 2021-12-07 22:20:55 -06:00
parent 20b9abf589
commit 072a56b2f9

View File

@ -1205,7 +1205,7 @@ class SSH2
return;
}
if (is_string($host)) {
if (Strings::is_stringable($host)) {
$this->host = $host;
$this->port = $port;
$this->timeout = $timeout;
@ -2179,7 +2179,7 @@ class SSH2
case $arg instanceof PrivateKey:
case $arg instanceof Agent:
case is_array($arg):
case is_string($arg):
case Strings::is_stringable($arg):
break;
default:
throw new \UnexpectedValueException('$password needs to either be an instance of \phpseclib3\Crypt\Common\PrivateKey, \System\SSH\Agent, an array or a string');
@ -2210,7 +2210,7 @@ class SSH2
$hasArray = true;
break;
}
if ($hasString || is_string($arg)) {
if ($hasString || Strings::is_stringable($arg)) {
$hasString = true;
break;
}
@ -2290,7 +2290,7 @@ class SSH2
}
if (strlen($this->last_interactive_response)) {
return !is_string($password) && !is_array($password) ? false : $this->keyboard_interactive_process($password);
return !Strings::is_stringable($password) && !is_array($password) ? false : $this->keyboard_interactive_process($password);
}
if ($password instanceof PrivateKey) {