#27982 [Opn->Asn]: Unhelpful error message when trying to overwrite a file using ftp

From: Date: Tue, 13 Apr 2004 19:49:46 +0000
Subject: #27982 [Opn->Asn]: Unhelpful error message when trying to overwrite a file using ftp
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-58075@lists.php.net to get a copy of this message
 ID:               27982
 Updated by:       sniper@php.net
 Reported By:      adam at trachtenberg dot com
-Status:           Open
+Status:           Assigned
 Bug Type:         FTP related
 Operating System: *
 PHP Version:      5CVS-2004-04-13 (dev)
-Assigned To:      
+Assigned To:      pollita
 New Comment:

Assigned to the maintainer. :)



Previous Comments:
------------------------------------------------------------------------

[2004-04-13 15:20:37] adam at trachtenberg dot com

Description:
------------
Trying to overwrite a file using ftp without enabling 
the "overwrite" context directive doesn't provide a 
helpful error message.

Line 460 of ext/standard/ftp_fopen_wrapper.c does:

  errno = EEXIST;
  goto errexit;

However, this error number doesn't get translated into 
something accessible. (That I can tell. Am I missing 
something?)

This patch adds a short error message, but I'm not sure 
if this is fixing a symptom instead of a root cause.

http://www.trachtenberg.com/patches/
ftp_overwrite_warning.txt

Reproduce code:
---------------
fopen('ftp://localhost/path/to/existing/file.txt',
'w');

or

file_put_contents('ftp://localhost/path/to/existing/file.txt',
'blah');

Expected result:
----------------
A useful warning message, like:

PHP Warning:  fopen(ftp://...@localhost/path/to/
existing/file.txt): failed to open stream: Cannot 
overwrite file in current mode
FTP server reports 213 17

Actual result:
--------------
General stream failure message, with no description:

PHP Warning:  fopen(ftp://...@localhost/path/to/
existing/file.txt): failed to open stream: FTP server 
reports 213 17


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=27982&edit=1


Thread (3 messages)

« previous php.bugs (#58075) next »