php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16058 ftp_get() try to create temp file in the c:\
Submitted: 2002-03-14 03:18 UTC Modified: 2002-07-10 23:08 UTC
From: alexf at spiralsolutions dot com Assigned:
Status: Closed Package: FTP related
PHP Version: 4.1.2 OS: Win2K
Private report: No CVE-ID: None
 [2002-03-14 03:18 UTC] alexf at spiralsolutions dot com
OS - Win2K, IIS, PHP.
If i use NTFS on my C drive under Win2K, and try to get file over ftp using ftp_get(), ftp_get() fails.
The problem is in C code in php_ftp.c:
C function tmpfile(), that used for creation of temporary files, try to create this file on C:\ (in the root directory, according to C docs):
================ Source code from php_ftp.c ===============
/* get to temporary file, so if there is an error, no  
   existing file gets clobbered
*/                 
   if ((tmpfp = tmpfile()) == NULL) {
           php_error(E_WARNING, "error opening tmpfile");
           RETURN_FALSE;
   }
===========================================================
But, for security reasons, root directory can't be writable by Anonymous user, so ftp_get() fails.
ftp_get() work only if we have c:\ world writable.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-07-10 23:08 UTC] sniper@php.net
Just use ftp_fget() as you can give it a filepointer you have opened wherever you wish:

http://www.php.net/manual/en/function.ftp-fget.php


(and regarding tmpfile(), it should store the temporary file in whatever your TEMP is set to?)

Not really any bug.

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