From a2d9622bf9644f85644546bb75504a2992756bb6 Mon Sep 17 00:00:00 2001 From: terrafrost Date: Sun, 20 Nov 2016 18:03:01 -0600 Subject: [PATCH] SFTP: update directory deletion check (#1059) --- phpseclib/Net/SFTP.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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; }