Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Resource-based data streams are no longer terminated prematurely.

Previously, the stream would be terminated if a line began with a period
because fgets() was returning the "\n" at the end of the previous call.

Bug: 18563
Patch by: Michael Slusarz
  • Loading branch information...
commit f4178ffbc035604927daadcd2a642f4bcc72f025 1 parent e5ed750
Jon Parise jparise authored
Showing with 11 additions and 1 deletion.
  1. +10 −1 SMTP.php
  2. +1 −0  package.xml
11 SMTP.php
View
@@ -1080,7 +1080,16 @@ 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 = fgets($data, 1024)) {
+ while (($line = fread($data, 8192)) !== false) {
+ /* 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)) {
+ $char = fread($data, 1);
+ $line .= $char;
+ if ($char != "\n") {
+ break;
+ }
+ }
$this->quotedata($line);
if (PEAR::isError($result = $this->_send($line))) {
return $result;
1  package.xml
View
@@ -34,6 +34,7 @@
- More kinds of socket write() failures are now detected.
- Improved PEAR_Error internal handling. (Bug 18469)
- External authentication methods are now supported via setAuthMethod().
+- Resource-based data streams are no longer terminated prematurely. (Bug 18563)
</notes>
<contents>
<dir baseinstalldir="Net" name="/">
Please sign in to comment.
Something went wrong with that request. Please try again.