diff --git a/phpseclib/Net/SFTP.php b/phpseclib/Net/SFTP.php index d5404994..43ad4f54 100644 --- a/phpseclib/Net/SFTP.php +++ b/phpseclib/Net/SFTP.php @@ -2237,7 +2237,12 @@ class Net_SFTP extends Net_SSH2 return false; } - if (empty($path)) { + if (is_object($path)) { + // It's an object. Cast it as string before we check anything else. + $path = (string) $path; + } + + if (!is_string($path) || $path == '') { return false; }