Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Avoid sending empty lines.

This change modifies the previous patch to explicitly check the length of the
string that was read from the stream.  The last fread() operation can return
an empty string, and passing an empty string to _send() can result in a socket

We need to use strlen() here instead of just testing ($line) because PHP
evaluates strings like "0" as FALSE.
  • Loading branch information...
commit f47c3fecd4dced12665b176b446388b35e4259e6 1 parent f4178ff
@jparise jparise authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  SMTP.php
2  SMTP.php
@@ -1080,7 +1080,7 @@ function data($data, $headers = null)
/* Stream the contents of the file resource out over our socket
* connection, line by line. Each line must be run through the
* quoting routine. */
- while (($line = fread($data, 8192)) !== false) {
+ while (strlen($line = fread($data, 8192)) > 0) {
/* If the last character is an newline, we need to grab the
* next character to check to see if it is a period. */
while (!feof($data)) {
Please sign in to comment.
Something went wrong with that request. Please try again.