Due to changed behaviour of fread (see php bug 24033) we cannot use large
authorstekkel <stekkel@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 24 Jul 2003 21:23:18 +0000 (21:23 +0000)
committerstekkel <stekkel@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 24 Jul 2003 21:23:18 +0000 (21:23 +0000)
buffersizes anymore because we cannot trust fread if the requested buffer is
actually returned.
blocking socket connections do not work anymore like they supposed to work
:(

git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@5418 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/imap_general.php

index 67efe425dd7112088e85831f336d84130775d73d..19ff2788bed5e14ad74152cc9d65c440d0fd367f 100755 (executable)
@@ -187,7 +187,8 @@ function sqimap_fread($imap_stream,$iSize,$filter=false,
     if (!$filter || !$outputstream) {
         $iBufferSize = $iSize;
     } else {
-        $iBufferSize = 62400; // multiple of 78 in case of base64 decoding.
+        // see php bug 24033. They changed fread behaviour %$^&$%
+        $iBufferSize = 780; // multiple of 78 in case of base64 decoding.
     }
     $iRet = $iSize - $iBufferSize;
     $iRetrieved = 0;
@@ -201,17 +202,6 @@ function sqimap_fread($imap_stream,$iSize,$filter=false,
             break;
         }
         $iRetrieved += $iBufferSize;
-        // if the returned lines are split, do not end with \n
-        // then we have a problem and need to adjust (happened with uw)
-        if ($bBufferSizeAdapted && substr($sRead,-1) !== "\n") {
-            // use fgets because it stops at \n.
-            // we can do it because it's for correction
-            $sRead .= fgets($imap_stream,$iBufferSize);
-            $iRetrieved += strlen($sRead);
-            if ($iRetrieved == $iSize) {
-                $bFinished = true;
-            }
-        }
         if ($filter) {
            // in case line-endings do not appear at position 78 we adapt the buffersize so we can base64 decode on the fly
            if (!$bBufferSizeAdapted) {