diff --git a/src/AbstractProtocol.php b/src/AbstractProtocol.php index d140869e..1772df32 100644 --- a/src/AbstractProtocol.php +++ b/src/AbstractProtocol.php @@ -135,7 +135,7 @@ public function __construct($host = '127.0.0.1', $port = null) $this->_validHost->addValidator(new HostnameValidator(HostnameValidator::ALLOW_ALL)); if (!$this->_validHost->isValid($host)) { - throw new Protocol\Exception\RuntimeException(join(', ', $this->_validHost->getMessages())); + throw new Protocol\Exception\RuntimeException(implode(', ', $this->_validHost->getMessages())); } $this->_host = $host; diff --git a/src/Exception.php b/src/Exception.php index 572a5736..cbd2f8e2 100644 --- a/src/Exception.php +++ b/src/Exception.php @@ -24,7 +24,6 @@ namespace Zend\Mail; /** - * @uses \Zend\Exception * @category Zend * @package Zend_Mail * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) diff --git a/src/Part/Exception.php b/src/Part/Exception.php index 4388831b..c14e6746 100644 --- a/src/Part/Exception.php +++ b/src/Part/Exception.php @@ -26,7 +26,7 @@ use Zend\Mail; /** - * @uses \Zend\Exception + * @uses \Zend\Mail\Exception * @category Zend * @package Zend_Mail * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) diff --git a/src/Protocol/Exception.php b/src/Protocol/Exception.php index bf7d1e60..c1d2e282 100644 --- a/src/Protocol/Exception.php +++ b/src/Protocol/Exception.php @@ -25,7 +25,7 @@ use Zend\Mail; /** - * @uses \Zend\Exception + * @uses \Zend\Mail\Exception * @category Zend * @package Zend_Mail * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) diff --git a/src/Protocol/Imap.php b/src/Protocol/Imap.php index f3221643..b89c0d5b 100644 --- a/src/Protocol/Imap.php +++ b/src/Protocol/Imap.php @@ -330,7 +330,7 @@ public function sendRequest($command, $tokens = array(), &$tag = null) foreach ($tokens as $token) { if (is_array($token)) { - if (@fputs($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('+ ')) { @@ -342,7 +342,7 @@ public function sendRequest($command, $tokens = array(), &$tag = null) } } - if (@fputs($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/Protocol/Smtp.php b/src/Protocol/Smtp.php index f25b874a..01ef19b8 100644 --- a/src/Protocol/Smtp.php +++ b/src/Protocol/Smtp.php @@ -177,7 +177,7 @@ public function helo($host = '127.0.0.1') // Validate client hostname if (!$this->_validHost->isValid($host)) { - throw new Exception\RuntimeException(join(', ', $this->_validHost->getMessages())); + throw new Exception\RuntimeException(implode(', ', $this->_validHost->getMessages())); } // Initiate helo sequence diff --git a/src/Storage/Exception.php b/src/Storage/Exception.php index c8290391..66758e6b 100644 --- a/src/Storage/Exception.php +++ b/src/Storage/Exception.php @@ -25,7 +25,7 @@ use Zend\Mail; /** - * @uses \Zend\Exception + * @uses \Zend\Mail\Exception * @category Zend * @package Zend_Mail * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) diff --git a/src/Storage/Writable/Maildir.php b/src/Storage/Writable/Maildir.php index 1c3b9ee6..41ce47c7 100644 --- a/src/Storage/Writable/Maildir.php +++ b/src/Storage/Writable/Maildir.php @@ -347,8 +347,8 @@ public function renameFolder($oldName, $newName) protected function _createUniqueId() { $id = ''; - $id .= function_exists('microtime') ? microtime(true) : (time() . ' ' . rand(0, 100000)); - $id .= '.' . (function_exists('posix_getpid') ? posix_getpid() : rand(50, 65535)); + $id .= microtime(true); + $id .= '.' . getmypid(); $id .= '.' . php_uname('n'); return $id; @@ -477,7 +477,7 @@ public function appendMessage($message, $folder = null, $flags = null, $recent = if (is_resource($message) && get_resource_type($message) == 'stream') { stream_copy_to_stream($message, $temp_file['handle']); } else { - fputs($temp_file['handle'], $message); + fwrite($temp_file['handle'], $message); } fclose($temp_file['handle']); @@ -819,8 +819,8 @@ protected function _calculateMaildirsize() $definition[] = $value . $type; } $definition = implode(',', $definition); - fputs($fh, "$definition\n"); - fputs($fh, "$total_size $messages\n"); + fwrite($fh, "$definition\n"); + fwrite($fh, "$total_size $messages\n"); fclose($fh); rename($tmp['filename'], $this->_rootdir . 'maildirsize'); foreach ($timestamps as $dir => $timestamp) { diff --git a/src/Transport/Exception.php b/src/Transport/Exception.php index 07ffe136..c2eaed80 100644 --- a/src/Transport/Exception.php +++ b/src/Transport/Exception.php @@ -25,7 +25,7 @@ use Zend\Mail; /** - * @uses \Zend\Exception + * @uses \Zend\Mail\Exception * @category Zend * @package Zend_Mail * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) diff --git a/test/MessageTest.php b/test/MessageTest.php index 948e5af4..3dcef329 100644 --- a/test/MessageTest.php +++ b/test/MessageTest.php @@ -162,7 +162,7 @@ public function testSplitInvalidMessage() { try { Mime\Decode::splitMessageStruct("--xxx\n", 'xxx'); - } catch (\Zend\Exception $e) { + } catch (\Zend\Mime\Exception $e) { return; // ok } @@ -173,7 +173,7 @@ public function testInvalidMailHandler() { try { $message = new Message(array('handler' => 1)); - } catch (\Zend\Exception $e) { + } catch (\Zend\Mime\Exception $e) { return; // ok } @@ -187,7 +187,7 @@ public function testMissingId() try { $message = new Message(array('handler' => $mail)); - } catch (\Zend\Exception $e) { + } catch (\Zend\Mime\Exception $e) { return; // ok } @@ -230,7 +230,7 @@ public function testSplitInvalidHeader() $header = ''; try { Mime\Decode::splitHeaderField($header); - } catch (\Zend\Exception $e) { + } catch (\Zend\Mime\Exception $e) { return; // ok } @@ -268,7 +268,7 @@ public function testNoContent() try { $message->getContent(); - } catch (\Zend\Exception $e) { + } catch (\Zend\Mime\Exception $e) { return; // ok } @@ -284,7 +284,7 @@ public function testEmptyHeader() $subject = null; try { $subject = $message->subject; - } catch (\Zend\Exception $e) { + } catch (\Zend\Mime\Exception $e) { // ok } if ($subject) { @@ -298,7 +298,7 @@ public function testEmptyBody() $part = null; try { $part = $message->getPart(1); - } catch (\Zend\Exception $e) { + } catch (\Zend\Mime\Exception $e) { // ok } if ($part) { @@ -329,7 +329,7 @@ public function testWrongMultipart() try { $message->getPart(1); - } catch (\Zend\Exception $e) { + } catch (\Zend\Mime\Exception $e) { return; // ok } $this->fail('no exception raised while getting part from message without boundary');