Permalink
Browse files

Enhanced the error checking in fSMTP::write() and fMailbox::write()

  • Loading branch information...
1 parent 7987bd5 commit a868b440931836221855b9512d61340c5bfc827c @wbond wbond committed Jun 3, 2011
Showing with 9 additions and 4 deletions.
  1. +4 −2 classes/fMailbox.php
  2. +5 −2 classes/fSMTP.php
View
@@ -12,7 +12,8 @@
* @package Flourish
* @link http://flourishlib.com/fMailbox
*
- * @version 1.0.0b11
+ * @version 1.0.0b12
+ * @changes 1.0.0b12 Enhanced the error checking in ::write() [wb, 2011-06-03]
* @changes 1.0.0b11 Added code to work around PHP bug #42682 (http://bugs.php.net/bug.php?id=42682) where `stream_select()` doesn't work on 64bit machines from PHP 5.2.0 to 5.2.5, improved connectivity error handling and timeouts while reading data [wb, 2011-01-10]
* @changes 1.0.0b10 Fixed ::parseMessage() to properly handle a header format edge case and properly set the `text` and `html` keys even when the email has an explicit `Content-disposition: inline` header [wb, 2010-11-25]
* @changes 1.0.0b9 Fixed a bug in ::parseMessage() that could cause HTML alternate content to be included in the `inline` content array instead of the `html` element [wb, 2010-09-20]
@@ -1426,7 +1427,8 @@ private function write($command, $expected=NULL)
}
$res = fwrite($this->connection, $command);
- if ($res === FALSE) {
+
+ if ($res === FALSE || $res === 0) {
throw new fConnectivityException(
'Unable to write data to %1$s server %2$s on port %3$s',
strtoupper($this->type),
View
@@ -9,7 +9,8 @@
* @package Flourish
* @link http://flourishlib.com/fSMTP
*
- * @version 1.0.0b10
+ * @version 1.0.0b11
+ * @changes 1.0.0b11 Enhanced the error checking for ::write() [wb, 2011-06-03]
* @changes 1.0.0b10 Added code to work around PHP bug #42682 (http://bugs.php.net/bug.php?id=42682) where `stream_select()` doesn't work on 64bit machines from PHP 5.2.0 to 5.2.5, improved timeouts while reading data [wb, 2011-01-10]
* @changes 1.0.0b9 Fixed a bug where lines starting with `.` and containing other content would have the `.` stripped [wb, 2010-09-11]
* @changes 1.0.0b8 Updated the class to use fEmail::getFQDN() [wb, 2010-09-07]
@@ -592,8 +593,10 @@ private function write($data, $expect)
if (fCore::getDebug($this->debug)) {
fCore::debug("Sending:\n" . trim($data), $this->debug);
}
+
$res = fwrite($this->connection, $data);
- if ($res === FALSE) {
+
+ if ($res === FALSE || $res === 0) {
throw new fConnectivityException('Unable to write data to SMTP server %1$s on port %2$s', $this->host, $this->port);
}
$response = $this->read($expect);

0 comments on commit a868b44

Please sign in to comment.