From 44078e5f40ce7311df0e97a68405fb1137377d41 Mon Sep 17 00:00:00 2001 From: Julius Beckmann Date: Wed, 20 Nov 2013 15:08:50 +0100 Subject: [PATCH] Making Net_SFTP::chdir capable of handling the empty string. Updated patch after hint from bantu. --- phpseclib/Net/SFTP.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/phpseclib/Net/SFTP.php b/phpseclib/Net/SFTP.php index 020d59be..5ebf9d28 100644 --- a/phpseclib/Net/SFTP.php +++ b/phpseclib/Net/SFTP.php @@ -635,8 +635,12 @@ class Net_SFTP extends Net_SSH2 { return false; } - // Suffix a slash - if (!$dir || $dir[strlen($dir) - 1] != '/') { + if ($dir === '') { + $dir = './'; + } + + // Suffix a slash if needed + if ($dir[strlen($dir) - 1] != '/') { $dir.= '/'; }