php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27982 Unhelpful error message when trying to overwrite a file using ftp
Submitted: 2004-04-13 15:20 UTC Modified: 2004-05-17 22:35 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: adam at trachtenberg dot com Assigned: pollita (profile)
Status: Closed Package: FTP related
PHP Version: 5CVS-2004-04-13 (dev) OS: *
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: adam at trachtenberg dot com
New email:
PHP Version: OS:

 

 [2004-04-13 15:20 UTC] 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-13 15:49 UTC] sniper@php.net
Assigned to the maintainer. :)

 [2004-05-17 22:35 UTC] pollita@php.net
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.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 11:01:30 2024 UTC