Permalink
Browse files

_send() (and by extension _put()) now return the number of bytes that…

… were

successfully written to the socket.  Previously, they just returned 'true' on
success.

All usage of _send() and _put() is private so this change results in no user
API changes.
  • Loading branch information...
jparise committed Apr 26, 2011
1 parent abe5820 commit b1fa30976afb16796e13c67c6c311289d0cf9a3f
Showing with 6 additions and 5 deletions.
  1. +6 −5 SMTP.php
View
@@ -250,7 +250,8 @@ function _debug($message)
*
* @param string $data The string of data to send.
*
- * @return mixed True on success or a PEAR_Error object on failure.
+ * @return mixed The number of bytes that were actually written,
+ * or a PEAR_Error object on failure.
*
* @access private
* @since 1.1.0
@@ -259,13 +260,13 @@ function _send($data)
{
$this->_debug("Send: $data");
- $error = $this->_socket->write($data);
- if ($error === false || PEAR::isError($error)) {
- $msg = ($error) ? $error->getMessage() : "unknown error";
+ $result = $this->_socket->write($data);
+ if ($result === false || PEAR::isError($result)) {
+ $msg = ($result) ? $result->getMessage() : "unknown error";
return PEAR::raiseError("Failed to write to socket: $msg");
}
- return true;
+ return $result;
}
/**

0 comments on commit b1fa309

Please sign in to comment.