pollita         Mon Sep  8 18:40:13 2003 EDT

  Modified files:              
    /php-src/ext/ftp    php_ftp.c 
  Log:
  MFB(r-1.74.2.13) Bug #25314 ASCII mode transfers behaving like binary when initiated 
from windows.
  
Index: php-src/ext/ftp/php_ftp.c
diff -u php-src/ext/ftp/php_ftp.c:1.94 php-src/ext/ftp/php_ftp.c:1.95
--- php-src/ext/ftp/php_ftp.c:1.94      Thu Aug 28 15:17:32 2003
+++ php-src/ext/ftp/php_ftp.c   Mon Sep  8 18:40:12 2003
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_ftp.c,v 1.94 2003/08/28 19:17:32 iliaa Exp $ */
+/* $Id: php_ftp.c,v 1.95 2003/09/08 22:40:12 pollita Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -649,9 +649,9 @@
        }
 
        if (ftp->autoseek && resumepos) {
-               outstream = php_stream_open_wrapper(local, "rb+", ENFORCE_SAFE_MODE | 
REPORT_ERRORS, NULL);
+               outstream = php_stream_open_wrapper(local, mode == FTPTYPE_ASCII ? 
"rt+" : "rb+", ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL);
                if (outstream == NULL) {
-                       outstream = php_stream_open_wrapper(local, "wb", 
ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL);
+                       outstream = php_stream_open_wrapper(local, mode == 
FTPTYPE_ASCII ? "wt" : "wb", ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL);
                }
                if (outstream != NULL) {
                        /* if autoresume is wanted seek to end */
@@ -663,7 +663,7 @@
                        }
                }
        } else {
-               outstream = php_stream_open_wrapper(local, "wb", ENFORCE_SAFE_MODE | 
REPORT_ERRORS, NULL);
+               outstream = php_stream_open_wrapper(local, mode == FTPTYPE_ASCII ? 
"wt" : "wb", ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL);
        }
 
        if (outstream == NULL)  {
@@ -707,9 +707,9 @@
        }
 
        if (ftp->autoseek && resumepos) {
-               outstream = php_stream_open_wrapper(local, "rb+", ENFORCE_SAFE_MODE | 
REPORT_ERRORS, NULL);
+               outstream = php_stream_open_wrapper(local, mode == FTPTYPE_ASCII ? 
"rt+" : "rb+", ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL);
                if (outstream == NULL) {
-                       outstream = php_stream_open_wrapper(local, "wb", 
ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL);
+                       outstream = php_stream_open_wrapper(local, mode == 
FTPTYPE_ASCII ? "wt" : "wb", ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL);
                }
                if (outstream != NULL) {
                        /* if autoresume is wanted seek to end */
@@ -721,7 +721,7 @@
                        }
                }
        } else {
-               outstream = php_stream_open_wrapper(local, "wb", ENFORCE_SAFE_MODE | 
REPORT_ERRORS, NULL);
+               outstream = php_stream_open_wrapper(local, mode == FTPTYPE_ASCII ? 
"wt" : "wb", ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL);
        }
 
        if (outstream == NULL)  {
@@ -902,7 +902,7 @@
        ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
        XTYPE(xtype, mode);
 
-       if (!(instream = php_stream_open_wrapper(local, "rb", ENFORCE_SAFE_MODE | 
REPORT_ERRORS, NULL))) {
+       if (!(instream = php_stream_open_wrapper(local, mode == FTPTYPE_ASCII ? "rt" : 
"rb", ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL))) {
                RETURN_FALSE;
        }
 
@@ -955,7 +955,7 @@
        ZEND_FETCH_RESOURCE(ftp, ftpbuf_t*, &z_ftp, -1, le_ftpbuf_name, le_ftpbuf);
        XTYPE(xtype, mode);
 
-       if (!(instream = php_stream_open_wrapper(local, "rb", ENFORCE_SAFE_MODE | 
REPORT_ERRORS, NULL))) {
+       if (!(instream = php_stream_open_wrapper(local, mode == FTPTYPE_ASCII ? "rt" : 
"rb", ENFORCE_SAFE_MODE | REPORT_ERRORS, NULL))) {
                RETURN_FALSE;
        }
 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to