From: webmaster at eeb-world dot de Operating system: Linux Debian PHP version: 5.2.0 PHP Bug Type: FTP related Bug description: ftp_rawlist() complains about open_basedir restriction
Description: ------------ ftp_rawlist() complains about open_basedir restriction effect and a failed creation of a temporary file. I backtraced this function in the PHP-source: ftp_rawlist() => INTERNAL BACKTRACE: ftp_list() (in php_ftp.c on line 732) ftp_genlist() (in ftp.c on line 651) php_stream_fopen_tmpfile() (in ftp.c on line 1600) php_open_temporary_fd() (in plain_wrapper.c on line 152) with first param = NULL And this function (php_open_temporary_fd()) has a new open_basedir check since 5.2.0. ( http://www.eeb-welt.de/php-error.gif ) I dont want to place /tmp in the open_basedir - param too or add an alternative TMPDIR to the env-vars. Reproduce code: --------------- function file_list($dir, $mode) { $result = ftp_rawlist($this->stream, $dir); $data = array(); if (is_array($result)) { foreach ($result as $key => $elem) { preg_match("#^(d|-)([rwx\-]{9}) +([\d]+) ([\w\d\-]+) +([\w\d\-]+) +([\d]+) ([\w]{3}) +([\d]{1,2}) ([\d :]{5}) (.{3,})#i", $elem, $result_detailed); if (isset($result_detailed[1])) { $today = getdate(); $time = strtotime("$result_detailed[8] $result_detailed[7] $today[year] $result_detailed[9]"); if ($result_detailed[1] == "d" && $mode == 0) { $data[] = array($result_detailed[10], $result_detailed[6], $time, 0); } elseif ($result_detailed[1] == "-" && $mode == 1 && !substr_count($result_detailed[10], ".ht") && !substr_count($result_detailed[10], ".php")) { $data[] = array($result_detailed[10], $result_detailed[6], $time, 1); } elseif ($mode == 2) { $type = ($result_detailed[1] == "-") ? 1 : 0; $data[] = array($result_detailed[10], $result_detailed[6], $time, $type); } } } return $data; } } Expected result: ---------------- Usually a 2-dimensional array and no basedir-errors Actual result: -------------- Warning: ftp_rawlist() [function.ftp-rawlist]: open_basedir restriction in effect. File(/tmp) is not within the allowed path(s): (/var/www/web1/html/:/var/www/web1/phptmp/:/var/www/web1/files/) in /var/www/web1/html/admin/classes/class_ftp.php on line 51 Warning: ftp_rawlist() [function.ftp-rawlist]: Unable to create temporary file. Check permissions in temporary files directory. in /var/www/web1/html/admin/classes/class_ftp.php on line 51 -- Edit bug report at http://bugs.php.net/?id=39386&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=39386&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=39386&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=39386&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=39386&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=39386&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=39386&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=39386&r=needscript Try newer version: http://bugs.php.net/fix.php?id=39386&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=39386&r=support Expected behavior: http://bugs.php.net/fix.php?id=39386&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=39386&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=39386&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=39386&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39386&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=39386&r=dst IIS Stability: http://bugs.php.net/fix.php?id=39386&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=39386&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=39386&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=39386&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=39386&r=mysqlcfg