- added feof() checks before fgets/fread
| | |
| | | $line = ''; |
| | | |
| | | if (!$fp) { |
| | | return $line; |
| | | return NULL; |
| | | } |
| | | |
| | | if (!$size) { |
| | |
| | | } |
| | | |
| | | do { |
| | | if (feof($fp)) { |
| | | return $line ? $line : NULL; |
| | | } |
| | | |
| | | $buffer = fgets($fp, $size); |
| | | |
| | | if ($buffer === false) { |
| | |
| | | $bytes = $a[2][0]; |
| | | while (strlen($out) < $bytes) { |
| | | $line = iil_ReadBytes($fp, $bytes); |
| | | if ($line === NULL) |
| | | break; |
| | | $out .= $line; |
| | | } |
| | | |
| | |
| | | global $my_prefs; |
| | | $data = ''; |
| | | $len = 0; |
| | | do { |
| | | while ($len < $bytes && !feof($fp)) |
| | | { |
| | | $d = fread($fp, $bytes-$len); |
| | | if (!empty($my_prefs['debug_mode'])) |
| | | write_log('imap', 'S: '. $d); |
| | |
| | | break; //nothing was read -> exit to avoid apache lockups |
| | | } |
| | | $len = $data_len; |
| | | } while ($len < $bytes); |
| | | }; |
| | | |
| | | return $data; |
| | | } |
| | |
| | | |
| | | function iil_Close(&$conn) { |
| | | if (iil_PutLine($conn->fp, "I LOGOUT")) { |
| | | fgets($conn->fp, 1024); |
| | | if (!feof($conn->fp)) |
| | | fgets($conn->fp, 1024); |
| | | fclose($conn->fp); |
| | | $conn->fp = false; |
| | | } |