Browse Source

MFB(r-1.74.2.13) Bug #25314 ASCII mode transfers behaving like binary when initiated from windows.

PEAR_1_4DEV
Sara Golemon 23 years ago
parent
commit
4936234fd8
  1. 16
      ext/ftp/php_ftp.c

16
ext/ftp/php_ftp.c

@ -649,9 +649,9 @@ PHP_FUNCTION(ftp_get)
}
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 @@ PHP_FUNCTION(ftp_get)
}
}
} 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 @@ PHP_FUNCTION(ftp_nb_get)
}
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 @@ PHP_FUNCTION(ftp_nb_get)
}
}
} 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 @@ PHP_FUNCTION(ftp_put)
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 @@ PHP_FUNCTION(ftp_nb_put)
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;
}

Loading…
Cancel
Save