Browse Source

Should compared strings with strings. Otherwise a string of just '0' is treated as false

indiri69 21 years ago
parent
commit
d05fcaf17e
2 changed files with 7 additions and 5 deletions
  1. 2 0
      ChangeLog
  2. 5 5
      functions/imap_general.php

+ 2 - 0
ChangeLog

@@ -136,6 +136,8 @@ Version 1.5.1 -- CVS
   - Added site configuration and custom translation engine support to translate 
   - Added site configuration and custom translation engine support to translate 
     plugin.
     plugin.
   - Fixed SquirrelSpell error output.  Patch courtesy David Boone.
   - Fixed SquirrelSpell error output.  Patch courtesy David Boone.
+  - Fixed bug in IMAP read routines that treated "0" as false instead of
+    a string (patch courtesy Maurice Makaay).
 
 
 Version 1.5.0
 Version 1.5.0
 --------------------
 --------------------

+ 5 - 5
functions/imap_general.php

@@ -219,20 +219,20 @@ function sqimap_fread($imap_stream,$iSize,$filter=false,
         if ($iRemaining < $iBufferSize) {
         if ($iRemaining < $iBufferSize) {
             $iBufferSize = $iRemaining;
             $iBufferSize = $iRemaining;
         }
         }
-        if (!$sRead) {
+        if ($sRead == '') {
             $results = false;
             $results = false;
             break;
             break;
         }
         }
-        if ($sReadRem) {
+        if ($sReadRem != '') {
             $sRead = $sReadRem . $sRead;
             $sRead = $sReadRem . $sRead;
             $sReadRem = '';
             $sReadRem = '';
         }
         }
 
 
-        if ($filter && $sRead) {
+        if ($filter && $sRead != '') {
            // in case the filter is base64 decoding we return a remainder
            // in case the filter is base64 decoding we return a remainder
            $sReadRem = $filter($sRead);
            $sReadRem = $filter($sRead);
         }
         }
-        if ($outputstream && $sRead) {
+        if ($outputstream && $sRead != '') {
            if (is_resource($outputstream)) {
            if (is_resource($outputstream)) {
                fwrite($outputstream,$sRead);
                fwrite($outputstream,$sRead);
            } else if ($outputstream == 'php://stdout') {
            } else if ($outputstream == 'php://stdout') {
@@ -989,4 +989,4 @@ function map_yp_alias($username) {
    return chop(substr($yp, strlen($username)+1));
    return chop(substr($yp, strlen($username)+1));
 }
 }
 
 
-?>
+?>