#39555 [Opn->Bgs]: ftp_rawlist not work with open_basedir
| From: | tony2001@php.net | Date: | Mon, 20 Nov 2006 16:25:04 +0000 |
| Subject: | #39555 [Opn->Bgs]: ftp_rawlist not work with open_basedir | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-105205@lists.php.net to get a copy of this message | ||
ID: 39555
Updated by: tony2001@php.net
Reported By: freidman at mail dot ru
-Status: Open
+Status: Bogus
Bug Type: FTP related
Operating System: Gentoo Linux
PHP Version: 5.2.0
New Comment:
>ftp_rawlist must create temporary file in directory which
> is set in environment variable TMPDIR, but it doesn't.
No, it was never supposed to work this way.
Previous Comments:
------------------------------------------------------------------------
[2006-11-20 16:04:15] freidman at mail dot ru
Changed the state to Open
------------------------------------------------------------------------
[2006-11-20 16:03:30] freidman at mail dot ru
ftp_rawlist must create temporary file in directory which is set in
environment variable TMPDIR, but it doesn't. It is always created in
/tmp directory, that is wrong. I understand that temporary directory
must be in open_basedir directive, but I want to specify temporary
directory to use.
------------------------------------------------------------------------
[2006-11-19 17:01:44] iliaa@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
In order to use tmp directory with open_basedir the directory
must be part of the open_basedir directive.
------------------------------------------------------------------------
[2006-11-19 10:18:27] freidman at mail dot ru
Description:
------------
This is related to bug #32708
There must be a way to set tmp-file creation of this functions, but
setting TMPDIR environment variable doesn't work. I don't want to
include /tmp dir in open_basedir directories.
Reproduce code:
---------------
<?php
putenv('TMPDIR=/hosting/clients/xxx.com/httpd/tmp');
echo getenv('TMPDIR');
// set up basic connection
$conn_id = ftp_connect("xxx.com");
// login with username and password
$login_result = ftp_login($conn_id, "xxx", "xxx");
// get the file list for /
$buff = ftp_rawlist($conn_id, '/');
// close the connection
ftp_close($conn_id);
// output the buffer
var_dump($buff);
?>
Expected result:
----------------
listing of files
Actual result:
--------------
/hosting/clients/xxx.com/httpd/tmp
Warning: ftp_rawlist() [function.ftp-rawlist]: open_basedir restriction
in effect. File(/tmp) is not within the allowed path(s):
(/hosting/clients/xxx.com/httpd:/usr/lib/php:/usr/local/lib/php) in
/hosting/clients/xxx.com/httpd/htdocs/a.php on line 15
Warning: ftp_rawlist() [function.ftp-rawlist]: Unable to create
temporary file. Check permissions in temporary files directory. in
/hosting/clients/xxx.com/httpd/htdocs/a.php on line 15
bool(false)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=39555&edit=1