ID: 12004
Updated by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
-Status: Analyzed
+Status: Assigned
Bug Type: *Directory/Filesystem functions
Operating System: linux
PHP Version: 4.0.5
-Assigned To:
+Assigned To: wez
New Comment:
We can probably do something about this with the new
streams architecture.
Assigning to myself.
Previous Comments:
------------------------------------------------------------------------
[2001-12-17 05:33:01] [EMAIL PROTECTED]
browser changed the title for some reason...
------------------------------------------------------------------------
[2001-12-17 05:28:35] [EMAIL PROTECTED]
The following patch will issue a warning for trying to open a ftp file
in anything other than read/write, - as no other methods are supported
by fopen(ftp)
as far as producing errors on 'writing to an ftp file opened read only'
- this is more complex as there is no indicators on the socket to tell
wheter it was opened read or write,
(internally the socket is opened rw as the actual connection is a 2 way
communication)
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 10:24:06 -0000
@@ -101,6 +101,14 @@
*issock = BAD_URL;
return NULL;
}
+ if (strcmp(mode, "r") && strcmp(mode, "w")) {
+ php_error(E_WARNING, "Invalid mode : ftp can only
access files in (r)ead or (w)rite mode");
+ php_url_free(resource);
+ *issock = BAD_URL;
+ return NULL;
+ }
+
+
/* use port 21 if one wasn't specified */
if (resource->port == 0)
resource->port = 21;
------------------------------------------------------------------------
[2001-10-20 22:40:26] [EMAIL PROTECTED]
Reproduced with PHP 4.1.0RC1
Seems like this is not supported at all..
--Jani
------------------------------------------------------------------------
[2001-07-10 06:07:36] [EMAIL PROTECTED]
Configure './configure'
'--with-apxs=/usr/local/apache/bin/apxs'
Command '--with-mysql' '--with-pgsql' '--with-zlib'
'--enable-ftp'
'--with-gd'
'--with-jpeg-dir=/usr/local/lib'
'--enable-versioning'
'--enable-track-vars=yes'
'--enable-url-includes'
'--enable-sysvshm'
'--enable-syscsem' '--with-gettext'
<?php
$file = "user:[EMAIL PROTECTED]/path/file.txt";
if (!($fp = fopen($file, "r+"))) {
echo "error: can't open file<br>";
exit;
}
fputs($fp, "test number one...");
fputs($fp, "test number two...");
fputs($fp, "etc...");
fclose($fp);
?>
-------------------------------
The problem is, that nothing is written in the file even though
fopen,fputs and
fclose do not return an error.
If you use fopen($file, "a+") the strings are written to file. But now
the problem is, that fopen tries to create that file even if it already
exists.
Ciao,
Tobias
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=12004&edit=1