ID: 43498 Updated by: [EMAIL PROTECTED] Reported By: vaneay at ifrance dot com -Status: Open +Status: Closed Bug Type: Filesystem function related Operating System: linux PHP Version: 5.2.5 New Comment:
This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2007-12-07 04:16:54] crrodriguez at suse dot de Right, this does not work: php -r var_dump(file_exists("ftp://anonymous:[EMAIL PROTECTED]/README.MIRRORS")); other ftp servers do work though, however, the curl library (that I assume is right) does indeed send TYPE I before SIZE try curl -v -I ftp://rsync.proftpd.de/README.MIRRORS fix: Index: ext/standard/ftp_fopen_wrapper.c =================================================================== RCS file: /repository/php-src/ext/standard/ftp_fopen_wrapper.c,v retrieving revision 1.85.2.4.2.4.2.2 diff -u -r1.85.2.4.2.4.2.2 ftp_fopen_wrapper.c --- ext/standard/ftp_fopen_wrapper.c 30 Sep 2007 05:49:44 -0000 1.85.2.4.2.4.2.2 +++ ext/standard/ftp_fopen_wrapper.c 7 Dec 2007 04:15:59 -0000 @@ -770,7 +770,7 @@ } else { ssb->sb.st_mode |= S_IFDIR; } - + php_stream_write_string(stream, "TYPE I\r\n"); php_stream_printf(stream TSRMLS_CC, "SIZE %s\r\n", (resource->path != NULL ? resource->path : "/")); result = GET_FTP_RESULT(stream); if (result < 200 || result > 299) { ------------------------------------------------------------------------ [2007-12-04 20:59:00] vaneay at ifrance dot com Description: ------------ on php 5.0 and up when trying to see if an ascii file exist on a ftp server tha follow RFC we get the error "SIZE not allowed in ASCII mode" example with ftp server proftpd 1.3.0 and up: $result = file_exists('ftp://user:[EMAIL PROTECTED]/dir/file.txt'); got always $result FALSE because in the server log the function file_exists() connect as the following : CONNECT LOGIN PASS CWD /dir/file.txt SIZE /dir/file.txt 550 SIZE not allowed in ASCII mode DISCONNECT where a normal FTP client does : CONNECT LOGIN PASS CWD /dir/file.txt TYPE I SIZE /dir/file.txt 213 93 <- got Size here DISCONNECT Reproduce code: --------------- $result = file_exists('ftp://user:[EMAIL PROTECTED]/dir/file.txt'); Expected result: ---------------- CONNECT LOGIN PASS CWD /dir/file.txt TYPE I SIZE /dir/file.txt 213 93 <- got Size here DISCONNECT Actual result: -------------- CONNECT LOGIN PASS CWD /dir/file.txt SIZE /dir/file.txt 550 SIZE not allowed in ASCII mode DISCONNECT ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=43498&edit=1