Don't strip trailing ws for literal data; fix error detection
authorMichael M Slusarz <slusarz@curecanti.org>
Thu, 4 Jun 2009 16:43:17 +0000 (10:43 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Thu, 4 Jun 2009 16:43:28 +0000 (10:43 -0600)
framework/Imap_Client/lib/Horde/Imap/Client/Socket.php

index d1155ca..8f9b8ae 100644 (file)
@@ -3233,7 +3233,7 @@ class Horde_Imap_Client_Socket extends Horde_Imap_Client_Base
             }
         }
 
-        if ($data === false) {
+        if (!strlen($data)) {
             if ($this->_debug) {
                 fwrite($this->_debug, '[ERROR: IMAP read error.]' . "\n");
             }
@@ -3244,7 +3244,7 @@ class Horde_Imap_Client_Socket extends Horde_Imap_Client_Base
             fwrite($this->_debug, 'S (' . microtime(true) . '): ' . ($binary ? '[BINARY DATA - ' . $len . ' bytes]' : $data));
         }
 
-        return rtrim($data);
+        return is_null($len) ? rtrim($data) : $data;
     }
 
     /**