From: adam at trachtenberg dot com Operating system: * PHP version: 5CVS-2004-04-13 (dev) PHP Bug Type: FTP related Bug description: Unhelpful error message when trying to overwrite a file using ftp
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://[EMAIL PROTECTED]/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://[EMAIL PROTECTED]/path/to/ existing/file.txt): failed to open stream: FTP server reports 213 17 -- Edit bug report at http://bugs.php.net/?id=27982&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=27982&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=27982&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=27982&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=27982&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=27982&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=27982&r=needscript Try newer version: http://bugs.php.net/fix.php?id=27982&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=27982&r=support Expected behavior: http://bugs.php.net/fix.php?id=27982&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=27982&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=27982&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=27982&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27982&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=27982&r=dst IIS Stability: http://bugs.php.net/fix.php?id=27982&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=27982&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=27982&r=float