diff --git a/src/Protocol/Imap.php b/src/Protocol/Imap.php index 750a88e8..1286a8d1 100644 --- a/src/Protocol/Imap.php +++ b/src/Protocol/Imap.php @@ -105,7 +105,7 @@ public function connect($host, $port = null, $ssl = false) */ protected function _nextLine() { - $line = @fgets($this->_socket); + $line = fgets($this->_socket); if ($line === false) { throw new Exception\RuntimeException('cannot read - connection closed?'); } @@ -309,7 +309,7 @@ public function sendRequest($command, $tokens = array(), &$tag = null) foreach ($tokens as $token) { if (is_array($token)) { - if (@fwrite($this->_socket, $line . ' ' . $token[0] . "\r\n") === false) { + if (fwrite($this->_socket, $line . ' ' . $token[0] . "\r\n") === false) { throw new Exception\RuntimeException('cannot write - connection closed?'); } if (!$this->_assumedNextLine('+ ')) { @@ -321,7 +321,7 @@ public function sendRequest($command, $tokens = array(), &$tag = null) } } - if (@fwrite($this->_socket, $line . "\r\n") === false) { + if (fwrite($this->_socket, $line . "\r\n") === false) { throw new Exception\RuntimeException('cannot write - connection closed?'); } } diff --git a/src/Storage/Folder/Maildir.php b/src/Storage/Folder/Maildir.php index 9b4b3909..4f7881fa 100644 --- a/src/Storage/Folder/Maildir.php +++ b/src/Storage/Folder/Maildir.php @@ -12,6 +12,7 @@ use Zend\Mail\Storage; use Zend\Mail\Storage\Exception; +use Zend\Stdlib\ErrorHandler; /** * @category Zend @@ -87,7 +88,9 @@ protected function _buildFolderTree() $this->_rootFolder = new Storage\Folder('/', '/', false); $this->_rootFolder->INBOX = new Storage\Folder('INBOX', 'INBOX', true); - $dh = @opendir($this->_rootdir); + ErrorHandler::start(E_WARNING); + $dh = opendir($this->_rootdir); + ErrorHandler::stop(); if (!$dh) { throw new Exception\RuntimeException("can't read folders in maildir"); } @@ -158,7 +161,9 @@ public function getFolders($rootFolder = null) $subname = trim($rootFolder, $this->_delim); while ($currentFolder) { - @list($entry, $subname) = @explode($this->_delim, $subname, 2); + ErrorHandler::start(E_NOTICE); + list($entry, $subname) = explode($this->_delim, $subname, 2); + ErrorHandler::stop(); $currentFolder = $currentFolder->$entry; if (!$subname) { break; diff --git a/src/Storage/Folder/Mbox.php b/src/Storage/Folder/Mbox.php index 06083c49..e5053c32 100644 --- a/src/Storage/Folder/Mbox.php +++ b/src/Storage/Folder/Mbox.php @@ -12,6 +12,7 @@ use Zend\Mail\Storage; use Zend\Mail\Storage\Exception; +use Zend\Stdlib\ErrorHandler; /** * @category Zend @@ -90,7 +91,9 @@ protected function _buildFolderTree($currentDir, $parentFolder = null, $parentGl $parentFolder = $this->_rootFolder; } - $dh = @opendir($currentDir); + ErrorHandler::start(E_WARNING); + $dh = opendir($currentDir); + ErrorHandler::stop(); if (!$dh) { throw new Exception\InvalidArgumentException("can't read dir $currentDir"); } @@ -132,7 +135,9 @@ public function getFolders($rootFolder = null) $currentFolder = $this->_rootFolder; $subname = trim($rootFolder, DIRECTORY_SEPARATOR); while ($currentFolder) { - @list($entry, $subname) = @explode(DIRECTORY_SEPARATOR, $subname, 2); + ErrorHandler::start(E_NOTICE); + list($entry, $subname) = explode(DIRECTORY_SEPARATOR, $subname, 2); + ErrorHandler::stop(); $currentFolder = $currentFolder->$entry; if (!$subname) { break; diff --git a/src/Storage/Maildir.php b/src/Storage/Maildir.php index d28549c2..40928fa6 100644 --- a/src/Storage/Maildir.php +++ b/src/Storage/Maildir.php @@ -11,6 +11,7 @@ namespace Zend\Mail\Storage; use Zend\Mail; +use Zend\Stdlib\ErrorHandler; /** * @category Zend @@ -265,14 +266,18 @@ protected function _openMaildir($dirname) $this->close(); } - $dh = @opendir($dirname . '/cur/'); + ErrorHandler::start(E_WARNING); + $dh = opendir($dirname . '/cur/'); + ErrorHandler::stop(); if (!$dh) { throw new Exception\RuntimeException('cannot open maildir'); } $this->_getMaildirFiles($dh, $dirname . '/cur/'); closedir($dh); - $dh = @opendir($dirname . '/new/'); + ErrorHandler::start(E_WARNING); + $dh = opendir($dirname . '/new/'); + ErrorHandler::stop(); if ($dh) { $this->_getMaildirFiles($dh, $dirname . '/new/', array(Mail\Storage::FLAG_RECENT)); closedir($dh); @@ -295,15 +300,20 @@ protected function _getMaildirFiles($dh, $dirname, $default_flags = array()) continue; } - @list($uniq, $info) = explode(':', $entry, 2); - @list(,$size) = explode(',', $uniq, 2); + ErrorHandler::start(E_NOTICE); + list($uniq, $info) = explode(':', $entry, 2); + list(,$size) = explode(',', $uniq, 2); + ErrorHandler::stop(); if ($size && $size[0] == 'S' && $size[1] == '=') { $size = substr($size, 2); } if (!ctype_digit($size)) { $size = null; } - @list($version, $flags) = explode(',', $info, 2); + + ErrorHandler::start(E_NOTICE); + list($version, $flags) = explode(',', $info, 2); + ErrorHandler::stop(); if ($version != 2) { $flags = ''; } diff --git a/src/Storage/Mbox.php b/src/Storage/Mbox.php index dca48797..d109ebbf 100644 --- a/src/Storage/Mbox.php +++ b/src/Storage/Mbox.php @@ -10,6 +10,8 @@ namespace Zend\Mail\Storage; +use Zend\Stdlib\ErrorHandler; + /** * @category Zend * @package Zend_Mail @@ -205,7 +207,9 @@ public function __construct($params) protected function _isMboxFile($file, $fileIsString = true) { if ($fileIsString) { - $file = @fopen($file, 'r'); + ErrorHandler::start(E_WARNING); + $file = fopen($file, 'r'); + ErrorHandler::stop(); if (!$file) { return false; } @@ -221,7 +225,9 @@ protected function _isMboxFile($file, $fileIsString = true) } if ($fileIsString) { - @fclose($file); + ErrorHandler::start(E_WARNING); + fclose($file); + ErrorHandler::stop(); } return $result; @@ -248,7 +254,9 @@ protected function _openMboxFile($filename) $this->_filemtime = filemtime($this->_filename); if (!$this->_isMboxFile($this->_fh, false)) { - @fclose($this->_fh); + ErrorHandler::start(E_WARNING); + fclose($this->_fh); + ErrorHandler::stop(); throw new Exception\InvalidArgumentException('file is not a valid mbox format'); } @@ -281,7 +289,9 @@ protected function _openMboxFile($filename) */ public function close() { - @fclose($this->_fh); + ErrorHandler::start(E_WARNING); + fclose($this->_fh); + ErrorHandler::stop(); $this->_positions = array(); } diff --git a/src/Storage/Writable/Maildir.php b/src/Storage/Writable/Maildir.php index d9333ae9..fce98b73 100644 --- a/src/Storage/Writable/Maildir.php +++ b/src/Storage/Writable/Maildir.php @@ -14,6 +14,7 @@ use Zend\Mail\Storage; use Zend\Mail\Storage\Exception as StorageException; use Zend\Mail\Storage\Folder; +use Zend\Stdlib\ErrorHandler; /** * @category Zend @@ -472,7 +473,10 @@ public function appendMessage($message, $folder = null, $flags = null, $recent = if (!link($temp_file['filename'], $new_filename)) { $exception = new StorageException\RuntimeException('cannot link message file to final dir'); } - @unlink($temp_file['filename']); + + ErrorHandler::start(E_WARNING); + unlink($temp_file['filename']); + ErrorHandler::stop(); if ($exception) { throw $exception; @@ -534,7 +538,10 @@ public function copyMessage($id, $folder) } elseif (!link($temp_file['filename'], $new_file)) { $exception = new StorageException\RuntimeException('cannot link message file to final dir'); } - @unlink($temp_file['filename']); + + ErrorHandler::start(E_WARNING); + unlink($temp_file['filename']); + ErrorHandler::stop(); if ($exception) { throw $exception; @@ -600,7 +607,10 @@ public function moveMessage($id, $folder) if (!rename($old_file, $new_file)) { $exception = new StorageException\RuntimeException('cannot move message file'); } - @unlink($temp_file['filename']); + + ErrorHandler::start(E_WARNING); + unlink($temp_file['filename']); + ErrorHandler::stop(); if ($exception) { throw $exception; @@ -691,7 +701,9 @@ public function setQuota($value) public function getQuota($fromStorage = false) { if ($fromStorage) { - $fh = @fopen($this->_rootdir . 'maildirsize', 'r'); + ErrorHandler::start(E_WARNING); + $fh = fopen($this->_rootdir . 'maildirsize', 'r'); + ErrorHandler::stop(); if (!$fh) { throw new StorageException\RuntimeException('cannot open maildirsize'); }