WTF?? Appearently the attachment is getting stripped off
somewhere along the way...
Index:
ext/ftp/ftp.c
===================================================================
RCS file: /repository/php-src/ext/ftp/ftp.c,v
retrieving revision 1.106
diff -u -r1.106 ftp.c
--- ext/ftp/ftp.c 5 Oct 2004 23:53:09 -0000 1.106
+++ ext/ftp/ftp.c 2 Feb 2005 19:09:28 -0000
@@ -846,16 +846,25 @@
* Everything Else \n
*/
#ifdef PHP_WIN32
- while ((s = strpbrk(ptr, "\r\n"))) {
- if (*s == '\n') {
- php_stream_putc(outstream, '\r');
+ while ((s = strpbrk(ptr, "\r\n")) && (s < e)) {
+
+ /* for some reason some servers prefix a \r before a \n,
+ * resulting in a \r\r\n in the buffer when
+ * the remote file already has windoze style line endings.
+ */
+
+ php_stream_write(outstream, ptr, (s - ptr));
+ php_stream_putc(outstream, '\r');
+ php_stream_putc(outstream, '\n');
+ if (*s == '\r' && *(s + 1) == '\r' && *(s + 2) == '\n') {
+ s += 3;
} else if (*s == '\r' && *(s + 1) == '\n') {
+ s += 2;
+ } else if (*s == '\r') {
+ s++;
+ } else if (*s == '\n') {
s++;
- }
- s++;
- php_stream_write(outstream, ptr, (s - ptr));
- if (*(s - 1) == '\r') {
- php_stream_putc(outstream, '\n');
}
ptr = s;
}
===================================================================
RCS file: /repository/php-src/ext/ftp/ftp.c,v
retrieving revision 1.106
diff -u -r1.106 ftp.c
--- ext/ftp/ftp.c 5 Oct 2004 23:53:09 -0000 1.106
+++ ext/ftp/ftp.c 2 Feb 2005 19:09:28 -0000
@@ -846,16 +846,25 @@
* Everything Else \n
*/
#ifdef PHP_WIN32
- while ((s = strpbrk(ptr, "\r\n"))) {
- if (*s == '\n') {
- php_stream_putc(outstream, '\r');
+ while ((s = strpbrk(ptr, "\r\n")) && (s < e)) {
+
+ /* for some reason some servers prefix a \r before a \n,
+ * resulting in a \r\r\n in the buffer when
+ * the remote file already has windoze style line endings.
+ */
+
+ php_stream_write(outstream, ptr, (s - ptr));
+ php_stream_putc(outstream, '\r');
+ php_stream_putc(outstream, '\n');
+ if (*s == '\r' && *(s + 1) == '\r' && *(s + 2) == '\n') {
+ s += 3;
} else if (*s == '\r' && *(s + 1) == '\n') {
+ s += 2;
+ } else if (*s == '\r') {
+ s++;
+ } else if (*s == '\n') {
s++;
- }
- s++;
- php_stream_write(outstream, ptr, (s - ptr));
- if (*(s - 1) == '\r') {
- php_stream_putc(outstream, '\n');
}
ptr = s;
}
From: Binam, Jesse [mailto:[EMAIL PROTECTED]
Sent: Wednesday, February 02, 2005 1:04 PM
To: internals@lists.php.net
Subject: RE: [PHP-DEV] [PATCH] Bug# 27633 - Wrong translation in ASCII mode
I guess the patch would be helpful
;)
From: Binam, Jesse [mailto:[EMAIL PROTECTED]
Sent: Wednesday, February 02, 2005 12:34 PM
To: internals@lists.php.net
Subject: [PHP-DEV] [PATCH] Bug# 27633 - Wrong translation in ASCII mode
Can somebody please
review and either commit and/or give me some feedback. It is against HEAD as of
about 30 minutes ago.
This is a data
integrity issue so I would think it would be extremely high
priority.
This is
a problem in both 4.3.10 and 5.0.3, this patch should apply nicely to both
branches.
Jess
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php