Markus Fischer wrote: >On Mon, Dec 17, 2001 at 07:08:34PM +0800, Alan Knowles wrote : > >>The whole file needs a bit of an overhall for that :) >> > > As most code does. But why not starting with it right away? > Bit like this? ;)
Index: ftp_fopen_wrapper.c =================================================================== RCS file: /repository/php4/ext/standard/ftp_fopen_wrapper.c,v retrieving revision 1.11 diff -u -r1.11 ftp_fopen_wrapper.c --- ftp_fopen_wrapper.c 9 Sep 2001 13:29:18 -0000 1.11 +++ ftp_fopen_wrapper.c 17 Dec 2001 11:05:47 -0000 @@ -92,15 +92,23 @@ resource = php_url_parse((char *) path); if (resource == NULL) { - php_error(E_WARNING, "Invalid URL specified, %s", path); + php_error(E_WARNING, "%s() Invalid URL specified, %s", get_active_function_name(TSRMLS_C), path); *issock = BAD_URL; return NULL; } else if (resource->path == NULL) { - php_error(E_WARNING, "No file-path specified"); + php_error(E_WARNING, "%s() No file-path specified",get_active_function_name(TSRMLS_C)); php_url_free(resource); *issock = BAD_URL; return NULL; } + if (strcmp(mode, "r") && strcmp(mode, "w")) { + php_error(E_WARNING, "%s() Invalid mode, ftp can only access files in (r)ead or (w)rite mode",get_active_function_name(TSRMLS_C)); + php_url_free(resource); + *issock = BAD_URL; + return NULL; + } + + /* use port 21 if one wasn't specified */ if (resource->port == 0) resource->port = 21; @@ -179,7 +187,7 @@ if (mode[0] == 'r') { /* when reading file, it must exist */ if (result > 299 || result < 200) { - php_error(E_WARNING, "File not found"); + php_error(E_WARNING, "%s() File not found",get_active_function_name(TSRMLS_C)); php_url_free(resource); SOCK_FCLOSE(*socketd); *socketd = 0; @@ -189,7 +197,7 @@ } else { /* when writing file, it must NOT exist */ if (result <= 299 && result >= 200) { - php_error(E_WARNING, "File already exists"); + php_error(E_WARNING, "%s() File already exists",get_active_function_name(TSRMLS_C)); php_url_free(resource); SOCK_FCLOSE(*socketd); *socketd = 0; -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]