From 8e0845f41151973f3bc4c68d69f027599b1fc125 Mon Sep 17 00:00:00 2001 From: Jim Wigginton Date: Fri, 20 Jan 2012 05:33:19 +0000 Subject: [PATCH] - make it so size() doesn't give an E_NOTICE if the size attribute isn't present - make delete() recursive by default - fix a bug that prevented inbound packets from being logged git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@192 21d32557-59b3-4da0-833f-c5933fad653e --- phpseclib/Net/SFTP.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/phpseclib/Net/SFTP.php b/phpseclib/Net/SFTP.php index 3f06c763..d01b68ef 100644 --- a/phpseclib/Net/SFTP.php +++ b/phpseclib/Net/SFTP.php @@ -1005,7 +1005,10 @@ class Net_SFTP extends Net_SSH2 { function _size($filename) { $result = $this->_stat($filename, NET_SFTP_LSTAT); - return $result === false ? false : $result['size']; + if ($result === false) { + return false; + } + return isset($result['size']) ? $result['size'] : -1; } /** @@ -1532,7 +1535,7 @@ class Net_SFTP extends Net_SSH2 { * @return Boolean * @access public */ - function delete($path, $recursive = false) + function delete($path, $recursive = true) { if (!($this->bitmap & NET_SSH2_MASK_LOGIN)) { return false; @@ -1872,7 +1875,7 @@ class Net_SFTP extends Net_SSH2 { } else { $this->packet_type_log[] = $packet_type; if (NET_SFTP_LOGGING == NET_SFTP_LOG_COMPLEX) { - $this->packet_log[] = $data; + $this->packet_log[] = $packet; } } }