From 7a6baeee6590fda2b5b97561e1c6fa0c68d3441f Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Sat, 23 Nov 2002 17:45:47 +0000 Subject: [PATCH] bug 634074 --- ChangeLog | 2 ++ read_dump.php3 | 16 ++++++---------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 04a02c63a..e71a58257 100755 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,8 @@ $Source$ 2002-11-23 Marc Delisle * libraries/display_tbl.lib.php3: clicking on a COUNT() column to sort + * read_dump.php3: bug 634074: we now use is_writeable() on the tmp + subdir, instead of looking for a dot in the open_basedir path 2002-11-22 Marc Delisle * libraries/display_tbl.lib.php3: numeric foreign keys used as alias diff --git a/read_dump.php3 b/read_dump.php3 index a838522cf..cc67805ac 100644 --- a/read_dump.php3 +++ b/read_dump.php3 @@ -300,21 +300,17 @@ if ($sql_file != 'none') { // directory if (!empty($open_basedir)) { - // check if '.' is in open_basedir - $split_char = (PMA_IS_WINDOWS ? ';' : ':'); - $pos = ereg('(^|' . $split_char . ')\\.(' . $split_char . '|$)', $open_basedir); - // from the PHP annotated manual - if (!$pos) { - // if no '.' in openbasedir, do not move the file (open_basedir - // may only be a prefix), force the error and let PHP reports - // it + $tmp_subdir = (PMA_IS_WINDOWS ? '.\\tmp\\' : './tmp/'); + + // function is_writeable() is valid on PHP3 and 4 + if (!is_writeable($tmp_subdir)) { + // if we cannot move the file, let PHP report the error error_reporting(E_ALL); $sql_query = PMA_readFile($sql_file, $sql_file_compression); } else { - $sql_file_new = (PMA_IS_WINDOWS ? '.\\tmp\\' : './tmp/') - . basename($sql_file); + $sql_file_new = $tmp_subdir . basename($sql_file); if (PMA_PHP_INT_VERSION < 40003) { copy($sql_file, $sql_file_new); } else {