dkelsey         Thu Jan 22 07:57:00 2009 UTC

  Added files:                 (Branch: PHP_5_3)
    /php-src/tests/security     open_basedir_glob_variation.phpt 

  Modified files:              
    /php-src/tests/security     open_basedir_error_log.phpt 
                                open_basedir_chmod.phpt 
                                open_basedir_chdir.phpt 
                                open_basedir_symlink.phpt 
                                open_basedir_is_executable.phpt 
                                open_basedir_scandir.phpt 
                                open_basedir_touch.phpt 
                                open_basedir_link.phpt 
                                open_basedir_rename.phpt 
                                open_basedir_readlink.phpt 
                                open_basedir_linkinfo.phpt 
                                open_basedir_mkdir.phpt 
                                open_basedir_rmdir.phpt 
                                open_basedir_fopen.phpt 
                                open_basedir_file_put_contents.phpt 
                                open_basedir.inc 
                                open_basedir_disk_free_space.phpt 
                                open_basedir_file_get_contents.phpt 
                                open_basedir_error_log_variation.phpt 
                                open_basedir_dir.phpt 
                                open_basedir_tempnam.phpt 
                                open_basedir_opendir.phpt 
                                open_basedir_copy_variation1.phpt 
                                open_basedir_copy.phpt 
                                open_basedir_unlink.phpt 
                                open_basedir_file.phpt 
  Log:
  fixed subtle bugs regarding attempting to chdir, plus cleanup issues. 
improved tempnam test, removed hardcoded line number. tested on windows, linux 
and linux 64bit.
  
http://cvs.php.net/viewvc.cgi/php-src/tests/security/open_basedir_error_log.phpt?r1=1.1.4.3&r2=1.1.4.4&diff_format=u
Index: php-src/tests/security/open_basedir_error_log.phpt
diff -u php-src/tests/security/open_basedir_error_log.phpt:1.1.4.3 
php-src/tests/security/open_basedir_error_log.phpt:1.1.4.4
--- php-src/tests/security/open_basedir_error_log.phpt:1.1.4.3  Mon Jun  9 
09:26:03 2008
+++ php-src/tests/security/open_basedir_error_log.phpt  Thu Jan 22 07:56:54 2009
@@ -6,14 +6,15 @@
 --FILE--
 <?php
 require_once "open_basedir.inc";
+$initdir = getcwd();
 test_open_basedir_before("error_log");
-$directory = dirname(__FILE__);
 
-var_dump(ini_set("error_log", $directory."/test/bad/bad.txt"));
-var_dump(ini_set("error_log", $directory."/test/bad.txt"));
-var_dump(ini_set("error_log", $directory."/bad.txt"));
-var_dump(ini_set("error_log", $directory."/test/ok/ok.txt"));
-var_dump(ini_set("error_log", $directory."/test/ok/ok.txt"));
+
+var_dump(ini_set("error_log", $initdir."/test/bad/bad.txt"));
+var_dump(ini_set("error_log", $initdir."/test/bad.txt"));
+var_dump(ini_set("error_log", $initdir."/bad.txt"));
+var_dump(ini_set("error_log", $initdir."/test/ok/ok.txt"));
+var_dump(ini_set("error_log", $initdir."/test/ok/ok.txt"));
 
 test_open_basedir_after("error_log");
 ?>
http://cvs.php.net/viewvc.cgi/php-src/tests/security/open_basedir_chmod.phpt?r1=1.1.4.2&r2=1.1.4.3&diff_format=u
Index: php-src/tests/security/open_basedir_chmod.phpt
diff -u php-src/tests/security/open_basedir_chmod.phpt:1.1.4.2 
php-src/tests/security/open_basedir_chmod.phpt:1.1.4.3
--- php-src/tests/security/open_basedir_chmod.phpt:1.1.4.2      Fri May  9 
08:39:44 2008
+++ php-src/tests/security/open_basedir_chmod.phpt      Thu Jan 22 07:56:55 2009
@@ -5,8 +5,9 @@
 --FILE--
 <?php
 require_once "open_basedir.inc";
+$initdir = getcwd();
+
 test_open_basedir_before("chmod");
-$directory = dirname(__FILE__);
 
 var_dump(chmod("../bad", 0600));
 var_dump(chmod("../bad/bad.txt", 0600));
@@ -17,12 +18,12 @@
 var_dump(chmod("../bad/./bad.txt", 0600));
 var_dump(chmod("./../.", 0600));
 
-var_dump(chmod($directory."/test/ok/ok.txt", 0600));
+var_dump(chmod($initdir."/test/ok/ok.txt", 0600));
 var_dump(chmod("./ok.txt", 0600));
 var_dump(chmod("ok.txt", 0600));
 var_dump(chmod("../ok/ok.txt", 0600));
 var_dump(chmod("../ok/./ok.txt", 0600));
-chmod($directory."/test/ok/ok.txt", 0777);
+chmod($initdir."/test/ok/ok.txt", 0777);
 
 test_open_basedir_after("chmod");
 ?>
http://cvs.php.net/viewvc.cgi/php-src/tests/security/open_basedir_chdir.phpt?r1=1.1.4.2&r2=1.1.4.3&diff_format=u
Index: php-src/tests/security/open_basedir_chdir.phpt
diff -u php-src/tests/security/open_basedir_chdir.phpt:1.1.4.2 
php-src/tests/security/open_basedir_chdir.phpt:1.1.4.3
--- php-src/tests/security/open_basedir_chdir.phpt:1.1.4.2      Fri May  9 
08:39:44 2008
+++ php-src/tests/security/open_basedir_chdir.phpt      Thu Jan 22 07:56:55 2009
@@ -6,7 +6,6 @@
 <?php
 require_once "open_basedir.inc";
 test_open_basedir_before("chdir");
-$directory = dirname(__FILE__);
 
 var_dump(chdir("../bad"));
 var_dump(chdir(".."));
http://cvs.php.net/viewvc.cgi/php-src/tests/security/open_basedir_symlink.phpt?r1=1.1.4.3&r2=1.1.4.4&diff_format=u
Index: php-src/tests/security/open_basedir_symlink.phpt
diff -u php-src/tests/security/open_basedir_symlink.phpt:1.1.4.3 
php-src/tests/security/open_basedir_symlink.phpt:1.1.4.4
--- php-src/tests/security/open_basedir_symlink.phpt:1.1.4.3    Mon Aug 11 
15:30:44 2008
+++ php-src/tests/security/open_basedir_symlink.phpt    Thu Jan 22 07:56:55 2009
@@ -11,30 +11,30 @@
 --FILE--
 <?php
 require_once "open_basedir.inc";
+$initdir = getcwd();
 test_open_basedir_before("symlink");
-$directory = dirname(__FILE__);
 
-$target = ($directory."/test/ok/ok.txt");
+$target = ($initdir."/test/ok/ok.txt");
 var_dump(symlink($target, "../bad/symlink.txt"));
 var_dump(symlink($target, "../symlink.txt"));
 var_dump(symlink($target, "../bad/./symlink.txt"));
 var_dump(symlink($target, "./.././symlink.txt"));
 
-$symlink = ($directory."/test/ok/symlink.txt");
+$symlink = ($initdir."/test/ok/symlink.txt");
 var_dump(symlink("../bad/bad.txt", $symlink));
 var_dump(symlink("../bad", $symlink));
 var_dump(symlink("../bad/./bad.txt", $symlink));
 var_dump(symlink("../bad/bad.txt", $symlink));
 var_dump(symlink("./.././bad", $symlink));
 
-$target = ($directory."/test/ok/ok.txt");
+$target = ($initdir."/test/ok/ok.txt");
 
 var_dump(symlink($target, $symlink));
 var_dump(unlink($symlink));
 
 var_dump(mkdir("ok2"));
-$symlink = ($directory."/test/ok/ok2/ok.txt");
-var_dump(symlink("../ok.txt", $symlink)); // $target == 
(dirname($symlink)."/".$target) == ($directory."/test/ok/ok.txt");
+$symlink = ($initdir."/test/ok/ok2/ok.txt");
+var_dump(symlink("../ok.txt", $symlink)); // $target == 
(dirname($symlink)."/".$target) == ($initdir."/test/ok/ok.txt");
 var_dump(unlink($symlink));
 
 test_open_basedir_after("symlink");
http://cvs.php.net/viewvc.cgi/php-src/tests/security/open_basedir_is_executable.phpt?r1=1.1.4.2&r2=1.1.4.3&diff_format=u
Index: php-src/tests/security/open_basedir_is_executable.phpt
diff -u php-src/tests/security/open_basedir_is_executable.phpt:1.1.4.2 
php-src/tests/security/open_basedir_is_executable.phpt:1.1.4.3
--- php-src/tests/security/open_basedir_is_executable.phpt:1.1.4.2      Fri May 
 9 08:39:44 2008
+++ php-src/tests/security/open_basedir_is_executable.phpt      Thu Jan 22 
07:56:55 2009
@@ -5,14 +5,14 @@
 --FILE--
 <?php
 require_once "open_basedir.inc";
+$initdir = getcwd();
 test_open_basedir_before("is_executable");
 test_open_basedir_error("is_executable");     
 
 var_dump(is_executable("ok.txt"));
 var_dump(is_executable("../ok/ok.txt"));
-$directory = dirname(__FILE__);
-var_dump(is_executable($directory."/test/ok/ok.txt"));
-var_dump(is_executable($directory."/test/ok/../ok/ok.txt"));
+var_dump(is_executable($initdir."/test/ok/ok.txt"));
+var_dump(is_executable($initdir."/test/ok/../ok/ok.txt"));
 
 test_open_basedir_after("is_executable");
 ?>
http://cvs.php.net/viewvc.cgi/php-src/tests/security/open_basedir_scandir.phpt?r1=1.1.4.3&r2=1.1.4.4&diff_format=u
Index: php-src/tests/security/open_basedir_scandir.phpt
diff -u php-src/tests/security/open_basedir_scandir.phpt:1.1.4.3 
php-src/tests/security/open_basedir_scandir.phpt:1.1.4.4
--- php-src/tests/security/open_basedir_scandir.phpt:1.1.4.3    Sun Sep  7 
22:34:40 2008
+++ php-src/tests/security/open_basedir_scandir.phpt    Thu Jan 22 07:56:56 2009
@@ -5,13 +5,13 @@
 --FILE--
 <?php
 require_once "open_basedir.inc";
+$initdir = getcwd();
 test_open_basedir_before("scandir");
 test_open_basedir_error("scandir");     
 
-$directory = dirname(__FILE__);
-var_dump(scandir($directory."/test/ok/"));
-var_dump(scandir($directory."/test/ok"));
-var_dump(scandir($directory."/test/ok/../ok"));
+var_dump(scandir($initdir."/test/ok/"));
+var_dump(scandir($initdir."/test/ok"));
+var_dump(scandir($initdir."/test/ok/../ok"));
 
 test_open_basedir_after("scandir");?>
 --CLEAN--
@@ -48,7 +48,7 @@
 Warning: scandir(): (errno 1): %s in %s on line %d
 bool(false)
 
-Warning: scandir(): open_basedir restriction in effect. File(../) is not 
within the allowed path(s): (.) in %s on line 80
+Warning: scandir(): open_basedir restriction in effect. File(../) is not 
within the allowed path(s): (.) in %s on line %d
 
 Warning: scandir(../): failed to open dir: %s in %s on line %d
 
http://cvs.php.net/viewvc.cgi/php-src/tests/security/open_basedir_touch.phpt?r1=1.1.4.2&r2=1.1.4.3&diff_format=u
Index: php-src/tests/security/open_basedir_touch.phpt
diff -u php-src/tests/security/open_basedir_touch.phpt:1.1.4.2 
php-src/tests/security/open_basedir_touch.phpt:1.1.4.3
--- php-src/tests/security/open_basedir_touch.phpt:1.1.4.2      Fri May  9 
08:39:44 2008
+++ php-src/tests/security/open_basedir_touch.phpt      Thu Jan 22 07:56:56 2009
@@ -5,8 +5,8 @@
 --FILE--
 <?php
 require_once "open_basedir.inc";
+$initdir = getcwd();
 test_open_basedir_before("touch");
-$directory = dirname(__FILE__);
 
 var_dump(touch("../bad"));
 var_dump(touch("../bad/bad.txt"));
@@ -17,7 +17,7 @@
 var_dump(touch("../bad/./bad.txt"));
 var_dump(touch("./../."));
 
-var_dump(touch($directory."/test/ok/ok.txt"));
+var_dump(touch($initdir."/test/ok/ok.txt"));
 var_dump(touch("./ok.txt"));
 var_dump(touch("ok.txt"));
 var_dump(touch("../ok/ok.txt"));
http://cvs.php.net/viewvc.cgi/php-src/tests/security/open_basedir_link.phpt?r1=1.1.4.2&r2=1.1.4.3&diff_format=u
Index: php-src/tests/security/open_basedir_link.phpt
diff -u php-src/tests/security/open_basedir_link.phpt:1.1.4.2 
php-src/tests/security/open_basedir_link.phpt:1.1.4.3
--- php-src/tests/security/open_basedir_link.phpt:1.1.4.2       Fri May  9 
08:39:44 2008
+++ php-src/tests/security/open_basedir_link.phpt       Thu Jan 22 07:56:56 2009
@@ -11,23 +11,23 @@
 --FILE--
 <?php
 require_once "open_basedir.inc";
+$initdir = getcwd();
 test_open_basedir_before("link");
-$directory = dirname(__FILE__);
 
-$target = ($directory."/test/ok/ok.txt");
+$target = ($initdir."/test/ok/ok.txt");
 var_dump(link($target, "../bad/link.txt"));
 var_dump(link($target, "../link.txt"));
 var_dump(link($target, "../bad/./link.txt"));
 var_dump(link($target, "./.././link.txt"));
 
-$link = ($directory."/test/ok/link.txt");
+$link = ($initdir."/test/ok/link.txt");
 var_dump(link("../bad/bad.txt", $link));
 var_dump(link("../bad", $link));
 var_dump(link("../bad/./bad.txt", $link));
 var_dump(link("../bad/bad.txt", $link));
 var_dump(link("./.././bad", $link));
 
-$target = ($directory."/test/ok/ok.txt");
+$target = ($initdir."/test/ok/ok.txt");
 
 var_dump(link($target, $link));
 var_dump(unlink($link));
http://cvs.php.net/viewvc.cgi/php-src/tests/security/open_basedir_rename.phpt?r1=1.1.4.2&r2=1.1.4.3&diff_format=u
Index: php-src/tests/security/open_basedir_rename.phpt
diff -u php-src/tests/security/open_basedir_rename.phpt:1.1.4.2 
php-src/tests/security/open_basedir_rename.phpt:1.1.4.3
--- php-src/tests/security/open_basedir_rename.phpt:1.1.4.2     Fri May  9 
08:39:44 2008
+++ php-src/tests/security/open_basedir_rename.phpt     Thu Jan 22 07:56:56 2009
@@ -5,14 +5,14 @@
 --FILE--
 <?php
 require_once "open_basedir.inc";
+$initdir = getcwd();
 test_open_basedir_before("rename");
-$directory = dirname(__FILE__);
 
 var_dump(rename("../bad/bad.txt", "rename.txt"));
 var_dump(rename(".././bad/bad.txt", "rename.txt"));
 var_dump(rename("../bad/../bad/bad.txt", "rename.txt"));
 var_dump(rename("./.././bad/bad.txt", "rename.txt"));
-var_dump(rename($directory."/test/bad/bad.txt", "rename.txt"));
+var_dump(rename($initdir."/test/bad/bad.txt", "rename.txt"));
 
 test_open_basedir_after("rename");
 ?>
http://cvs.php.net/viewvc.cgi/php-src/tests/security/open_basedir_readlink.phpt?r1=1.1.4.2&r2=1.1.4.3&diff_format=u
Index: php-src/tests/security/open_basedir_readlink.phpt
diff -u php-src/tests/security/open_basedir_readlink.phpt:1.1.4.2 
php-src/tests/security/open_basedir_readlink.phpt:1.1.4.3
--- php-src/tests/security/open_basedir_readlink.phpt:1.1.4.2   Fri May  9 
08:39:44 2008
+++ php-src/tests/security/open_basedir_readlink.phpt   Thu Jan 22 07:56:56 2009
@@ -11,25 +11,25 @@
 --FILE--
 <?php
 require_once "open_basedir.inc";
+$initdir = getcwd();
 test_open_basedir_before("readlink", FALSE);
-$directory = dirname(__FILE__);
 
-chdir($directory);
+chdir($initdir);
 
-$target = ($directory."/test/bad/bad.txt");
-$symlink = ($directory."/test/ok/symlink.txt");
+$target = ($initdir."/test/bad/bad.txt");
+$symlink = ($initdir."/test/ok/symlink.txt");
 var_dump(symlink($target, $symlink));
 
-chdir($directory."/test/ok");
+chdir($initdir."/test/ok");
 
 var_dump(readlink("symlink.txt"));
 var_dump(readlink("../ok/symlink.txt"));
 var_dump(readlink("../ok/./symlink.txt"));
 var_dump(readlink("./symlink.txt"));
-var_dump(readlink($directory."/test/ok/symlink.txt"));
+var_dump(readlink($initdir."/test/ok/symlink.txt"));
 
-$target = ($directory."/test/ok/ok.txt");
-$symlink = ($directory."/test/ok/symlink.txt");
+$target = ($initdir."/test/ok/ok.txt");
+$symlink = ($initdir."/test/ok/symlink.txt");
 var_dump(symlink($target, $symlink));
 var_dump(readlink($symlink));
 var_dump(unlink($symlink));
http://cvs.php.net/viewvc.cgi/php-src/tests/security/open_basedir_linkinfo.phpt?r1=1.1.4.2&r2=1.1.4.3&diff_format=u
Index: php-src/tests/security/open_basedir_linkinfo.phpt
diff -u php-src/tests/security/open_basedir_linkinfo.phpt:1.1.4.2 
php-src/tests/security/open_basedir_linkinfo.phpt:1.1.4.3
--- php-src/tests/security/open_basedir_linkinfo.phpt:1.1.4.2   Fri May  9 
08:39:44 2008
+++ php-src/tests/security/open_basedir_linkinfo.phpt   Thu Jan 22 07:56:56 2009
@@ -11,25 +11,25 @@
 --FILE--
 <?php
 require_once "open_basedir.inc";
+$initdir = getcwd();
 test_open_basedir_before("linkinfo", FALSE);
-$directory = dirname(__FILE__);
 
-chdir($directory);
+chdir($initdir);
 
-$target = ($directory."/test/bad/bad.txt");
-$symlink = ($directory."/test/ok/symlink.txt");
+$target = ($initdir."/test/bad/bad.txt");
+$symlink = ($initdir."/test/ok/symlink.txt");
 var_dump(symlink($target, $symlink));
 
-chdir($directory."/test/ok");
+chdir($initdir."/test/ok");
 
 var_dump(linkinfo("symlink.txt"));
 var_dump(linkinfo("../ok/symlink.txt"));
 var_dump(linkinfo("../ok/./symlink.txt"));
 var_dump(linkinfo("./symlink.txt"));
-var_dump(linkinfo($directory."/test/ok/symlink.txt"));
+var_dump(linkinfo($initdir."/test/ok/symlink.txt"));
 
-$target = ($directory."/test/ok/ok.txt");
-$symlink = ($directory."/test/ok/symlink.txt");
+$target = ($initdir."/test/ok/ok.txt");
+$symlink = ($initdir."/test/ok/symlink.txt");
 var_dump(symlink($target, $symlink));
 var_dump(linkinfo($symlink));
 var_dump(unlink($symlink));
http://cvs.php.net/viewvc.cgi/php-src/tests/security/open_basedir_mkdir.phpt?r1=1.1.4.2&r2=1.1.4.3&diff_format=u
Index: php-src/tests/security/open_basedir_mkdir.phpt
diff -u php-src/tests/security/open_basedir_mkdir.phpt:1.1.4.2 
php-src/tests/security/open_basedir_mkdir.phpt:1.1.4.3
--- php-src/tests/security/open_basedir_mkdir.phpt:1.1.4.2      Fri May  9 
08:39:44 2008
+++ php-src/tests/security/open_basedir_mkdir.phpt      Thu Jan 22 07:56:56 2009
@@ -11,16 +11,16 @@
 --FILE--
 <?php
 require_once "open_basedir.inc";
+$initdir = getcwd();
 test_open_basedir_before("mkdir");
-$directory = dirname(__FILE__);
 
 var_dump(mkdir("../bad/blah"));
 var_dump(mkdir("../blah"));
 var_dump(mkdir("../bad/./blah"));
 var_dump(mkdir("./.././blah"));
 
-var_dump(mkdir($directory."/test/ok/blah"));
-var_dump(rmdir($directory."/test/ok/blah"));
+var_dump(mkdir($initdir."/test/ok/blah"));
+var_dump(rmdir($initdir."/test/ok/blah"));
 test_open_basedir_after("mkdir");
 ?>
 --CLEAN--
http://cvs.php.net/viewvc.cgi/php-src/tests/security/open_basedir_rmdir.phpt?r1=1.1.4.2&r2=1.1.4.3&diff_format=u
Index: php-src/tests/security/open_basedir_rmdir.phpt
diff -u php-src/tests/security/open_basedir_rmdir.phpt:1.1.4.2 
php-src/tests/security/open_basedir_rmdir.phpt:1.1.4.3
--- php-src/tests/security/open_basedir_rmdir.phpt:1.1.4.2      Fri May  9 
08:39:44 2008
+++ php-src/tests/security/open_basedir_rmdir.phpt      Thu Jan 22 07:56:56 2009
@@ -5,14 +5,14 @@
 --FILE--
 <?php
 require_once "open_basedir.inc";
+$initdir = getcwd();
 test_open_basedir_before("rmdir");
-$directory = dirname(__FILE__);
 
 var_dump(rmdir("../bad"));
 var_dump(rmdir(".././bad"));
 var_dump(rmdir("../bad/../bad"));
 var_dump(rmdir("./.././bad"));
-var_dump(rmdir($directory."/test/bad"));
+var_dump(rmdir($initdir."/test/bad"));
 
 test_open_basedir_after("rmdir");
 ?>
http://cvs.php.net/viewvc.cgi/php-src/tests/security/open_basedir_fopen.phpt?r1=1.1.4.3&r2=1.1.4.4&diff_format=u
Index: php-src/tests/security/open_basedir_fopen.phpt
diff -u php-src/tests/security/open_basedir_fopen.phpt:1.1.4.3 
php-src/tests/security/open_basedir_fopen.phpt:1.1.4.4
--- php-src/tests/security/open_basedir_fopen.phpt:1.1.4.3      Sun Sep  7 
22:34:40 2008
+++ php-src/tests/security/open_basedir_fopen.phpt      Thu Jan 22 07:56:56 2009
@@ -5,8 +5,8 @@
 --FILE--
 <?php
 require_once "open_basedir.inc";
+$initdir = getcwd();
 test_open_basedir_before("fopen");
-$directory = dirname(__FILE__);
 
 var_dump(fopen("../bad", "r"));
 var_dump(fopen("../bad/bad.txt", "r"));
@@ -17,7 +17,7 @@
 var_dump(fopen("../bad/./bad.txt", "r"));
 var_dump(fopen("./../.", "r"));
 
-var_dump(fopen($directory."/test/ok/ok.txt", "r"));
+var_dump(fopen($initdir."/test/ok/ok.txt", "r"));
 var_dump(fopen("./ok.txt", "r"));
 var_dump(fopen("ok.txt", "r"));
 var_dump(fopen("../ok/ok.txt", "r"));
http://cvs.php.net/viewvc.cgi/php-src/tests/security/open_basedir_file_put_contents.phpt?r1=1.1.4.3&r2=1.1.4.4&diff_format=u
Index: php-src/tests/security/open_basedir_file_put_contents.phpt
diff -u php-src/tests/security/open_basedir_file_put_contents.phpt:1.1.4.3 
php-src/tests/security/open_basedir_file_put_contents.phpt:1.1.4.4
--- php-src/tests/security/open_basedir_file_put_contents.phpt:1.1.4.3  Sun Sep 
 7 22:34:40 2008
+++ php-src/tests/security/open_basedir_file_put_contents.phpt  Thu Jan 22 
07:56:56 2009
@@ -5,14 +5,14 @@
 --FILE--
 <?php
 require_once "open_basedir.inc";
+$initdir = getcwd();
 test_open_basedir_before("file_put_contents");
-$directory = dirname(__FILE__);
 
 var_dump(file_put_contents("../bad/bad.txt", "Hello World!"));
 var_dump(file_put_contents(".././bad/bad.txt", "Hello World!"));
 var_dump(file_put_contents("../bad/../bad/bad.txt", "Hello World!"));
 var_dump(file_put_contents("./.././bad/bad.txt", "Hello World!"));
-var_dump(file_put_contents($directory."/test/bad/bad.txt", "Hello World!"));
+var_dump(file_put_contents($initdir."/test/bad/bad.txt", "Hello World!"));
 
 test_open_basedir_after("file_put_contents");
 ?>
http://cvs.php.net/viewvc.cgi/php-src/tests/security/open_basedir.inc?r1=1.1.4.2&r2=1.1.4.3&diff_format=u
Index: php-src/tests/security/open_basedir.inc
diff -u php-src/tests/security/open_basedir.inc:1.1.4.2 
php-src/tests/security/open_basedir.inc:1.1.4.3
--- php-src/tests/security/open_basedir.inc:1.1.4.2     Fri May  9 08:39:44 2008
+++ php-src/tests/security/open_basedir.inc     Thu Jan 22 07:56:56 2009
@@ -59,7 +59,7 @@
 
 function create_directories() {
     delete_directories();
-    $directory = dirname(__FILE__);
+    $directory = getcwd();
 
     var_dump(mkdir($directory."/test"));
     var_dump(mkdir($directory."/test/ok"));
@@ -69,25 +69,28 @@
 }
 
 function delete_directories() {
-    $directory = (dirname(__FILE__)."/test");
+    $directory = (getcwd()."/test");
     recursive_delete_directory($directory);
 }
 
 function test_open_basedir_error($function) {
+    global $savedDirectory;
     var_dump($function("../bad"));
     var_dump($function("../bad/bad.txt"));
     var_dump($function(".."));
     var_dump($function("../"));
     var_dump($function("/"));
     var_dump($function("../bad/."));
-    $directory = dirname(__FILE__);
+    $directory = $savedDirectory;
     var_dump($function($directory."/test/bad/bad.txt"));
     var_dump($function($directory."/test/bad/../bad/bad.txt"));
 }
 
 function test_open_basedir_before($function, $change = TRUE) {
+    global $savedDirectory;
     echo "*** Testing open_basedir configuration [$function] ***\n";
-    $directory = dirname(__FILE__);
+    $directory = getcwd();
+    $savedDirectory = $directory;
     var_dump(chdir($directory));
     create_directories();
 
@@ -104,26 +107,29 @@
 
 // This is used by functions that return an array on success
 function test_open_basedir_array($function) {
+    global $savedDirectory;
+
     test_open_basedir_before($function);
     test_open_basedir_error($function); 
     var_dump(is_array($function("./../.")));
     var_dump(is_array($function("../ok")));
     var_dump(is_array($function("ok.txt")));
     var_dump(is_array($function("../ok/ok.txt")));
-    $directory = dirname(__FILE__);
+    $directory = $savedDirectory;
     var_dump(is_array($function($directory."/test/ok/ok.txt")));
     var_dump(is_array($function($directory."/test/ok/../ok/ok.txt")));
     test_open_basedir_after($function);
 }
 
 function test_open_basedir($function) {
+    global $savedDirectory;
     test_open_basedir_before($function);
     test_open_basedir_error($function);     
     var_dump($function("./../."));
     var_dump($function("../ok"));
     var_dump($function("ok.txt"));
     var_dump($function("../ok/ok.txt"));
-    $directory = dirname(__FILE__);
+    $directory = $savedDirectory;
     var_dump($function($directory."/test/ok/ok.txt"));
     var_dump($function($directory."/test/ok/../ok/ok.txt"));
     test_open_basedir_after($function);
http://cvs.php.net/viewvc.cgi/php-src/tests/security/open_basedir_disk_free_space.phpt?r1=1.1.4.2&r2=1.1.4.3&diff_format=u
Index: php-src/tests/security/open_basedir_disk_free_space.phpt
diff -u php-src/tests/security/open_basedir_disk_free_space.phpt:1.1.4.2 
php-src/tests/security/open_basedir_disk_free_space.phpt:1.1.4.3
--- php-src/tests/security/open_basedir_disk_free_space.phpt:1.1.4.2    Fri May 
 9 08:39:44 2008
+++ php-src/tests/security/open_basedir_disk_free_space.phpt    Thu Jan 22 
07:56:56 2009
@@ -5,11 +5,11 @@
 --FILE--
 <?php
 require_once "open_basedir.inc";
-
+$initdir = getcwd();
 test_open_basedir_before("disk_free_space");
 test_open_basedir_error("disk_free_space");     
-$directory = dirname(__FILE__);
-var_dump(disk_free_space($directory."/test/ok"));
+
+var_dump(disk_free_space($initdir."/test/ok"));
 test_open_basedir_after("disk_free_space");
 ?>
 --CLEAN--
http://cvs.php.net/viewvc.cgi/php-src/tests/security/open_basedir_file_get_contents.phpt?r1=1.1.4.3&r2=1.1.4.4&diff_format=u
Index: php-src/tests/security/open_basedir_file_get_contents.phpt
diff -u php-src/tests/security/open_basedir_file_get_contents.phpt:1.1.4.3 
php-src/tests/security/open_basedir_file_get_contents.phpt:1.1.4.4
--- php-src/tests/security/open_basedir_file_get_contents.phpt:1.1.4.3  Sun Sep 
 7 22:34:39 2008
+++ php-src/tests/security/open_basedir_file_get_contents.phpt  Thu Jan 22 
07:56:56 2009
@@ -5,14 +5,14 @@
 --FILE--
 <?php
 require_once "open_basedir.inc";
-$directory = dirname(__FILE__);
+$initdir = getcwd();
 test_open_basedir_before("file_get_contents");
 test_open_basedir_error("file_get_contents");
      
 var_dump(file_get_contents("ok.txt"));
 var_dump(file_get_contents("../ok/ok.txt"));
-var_dump(file_get_contents($directory."/test/ok/ok.txt"));
-var_dump(file_get_contents($directory."/test/ok/../ok/ok.txt"));
+var_dump(file_get_contents($initdir."/test/ok/ok.txt"));
+var_dump(file_get_contents($initdir."/test/ok/../ok/ok.txt"));
 
 test_open_basedir_after("file_get_contents");
 ?>
http://cvs.php.net/viewvc.cgi/php-src/tests/security/open_basedir_error_log_variation.phpt?r1=1.1.4.3&r2=1.1.4.4&diff_format=u
Index: php-src/tests/security/open_basedir_error_log_variation.phpt
diff -u php-src/tests/security/open_basedir_error_log_variation.phpt:1.1.4.3 
php-src/tests/security/open_basedir_error_log_variation.phpt:1.1.4.4
--- php-src/tests/security/open_basedir_error_log_variation.phpt:1.1.4.3        
Sun Sep  7 22:34:39 2008
+++ php-src/tests/security/open_basedir_error_log_variation.phpt        Thu Jan 
22 07:56:56 2009
@@ -5,14 +5,15 @@
 --FILE--
 <?php
 require_once "open_basedir.inc";
+$initdir = getcwd();
 test_open_basedir_before("error_log");
-$directory = dirname(__FILE__);
+
 define("DESTINATION_IS_FILE", 3);
 
-var_dump(error_log("Hello World!", DESTINATION_IS_FILE, 
$directory."/test/bad/bad.txt"));
-var_dump(error_log("Hello World!", DESTINATION_IS_FILE, 
$directory."/test/bad.txt"));
-var_dump(error_log("Hello World!", DESTINATION_IS_FILE, 
$directory."/bad.txt"));
-var_dump(error_log("Hello World!", DESTINATION_IS_FILE, 
$directory."/test/ok/ok.txt"));
+var_dump(error_log("Hello World!", DESTINATION_IS_FILE, 
$initdir."/test/bad/bad.txt"));
+var_dump(error_log("Hello World!", DESTINATION_IS_FILE, 
$initdir."/test/bad.txt"));
+var_dump(error_log("Hello World!", DESTINATION_IS_FILE, $initdir."/bad.txt"));
+var_dump(error_log("Hello World!", DESTINATION_IS_FILE, 
$initdir."/test/ok/ok.txt"));
 
 test_open_basedir_after("error_log");
 ?>
http://cvs.php.net/viewvc.cgi/php-src/tests/security/open_basedir_dir.phpt?r1=1.1.4.3&r2=1.1.4.4&diff_format=u
Index: php-src/tests/security/open_basedir_dir.phpt
diff -u php-src/tests/security/open_basedir_dir.phpt:1.1.4.3 
php-src/tests/security/open_basedir_dir.phpt:1.1.4.4
--- php-src/tests/security/open_basedir_dir.phpt:1.1.4.3        Sun Sep  7 
22:34:39 2008
+++ php-src/tests/security/open_basedir_dir.phpt        Thu Jan 22 07:56:56 2009
@@ -5,13 +5,14 @@
 --FILE--
 <?php
 require_once "open_basedir.inc";
+$initdir = getcwd();
+
 test_open_basedir_before("dir");
 test_open_basedir_error("dir");     
 
-$directory = dirname(__FILE__);
-var_dump(dir($directory."/test/ok/"));
-var_dump(dir($directory."/test/ok"));
-var_dump(dir($directory."/test/ok/../ok"));
+var_dump(dir($initdir."/test/ok/"));
+var_dump(dir($initdir."/test/ok"));
+var_dump(dir($initdir."/test/ok/../ok"));
 
 test_open_basedir_after("dir");?>
 --CLEAN--
http://cvs.php.net/viewvc.cgi/php-src/tests/security/open_basedir_tempnam.phpt?r1=1.1.4.2&r2=1.1.4.3&diff_format=u
Index: php-src/tests/security/open_basedir_tempnam.phpt
diff -u php-src/tests/security/open_basedir_tempnam.phpt:1.1.4.2 
php-src/tests/security/open_basedir_tempnam.phpt:1.1.4.3
--- php-src/tests/security/open_basedir_tempnam.phpt:1.1.4.2    Fri May  9 
08:39:44 2008
+++ php-src/tests/security/open_basedir_tempnam.phpt    Thu Jan 22 07:56:56 2009
@@ -5,8 +5,8 @@
 --FILE--
 <?php
 require_once "open_basedir.inc";
+$initdir = getcwd();
 test_open_basedir_before("tempnam");
-$directory = dirname(__FILE__);
 
 var_dump(tempnam("../bad", "test"));
 var_dump(tempnam("..", "test"));
@@ -14,8 +14,19 @@
 var_dump(tempnam("/", "test"));
 var_dump(tempnam("../bad/.", "test"));
 var_dump(tempnam("./../.", "test"));
+var_dump(tempnam("", "test"));
 
-$file = tempnam($directory."/test/ok", "test");
+//absolute test
+$file = tempnam($initdir."/test/ok", "test");
+var_dump($file);
+var_dump(unlink($file));
+
+//relative test
+$file = tempnam(".", "test");
+var_dump($file);
+var_dump(unlink($file));
+
+$file = tempnam("../ok", "test");
 var_dump($file);
 var_dump(unlink($file));
 
@@ -51,6 +62,13 @@
 
 Warning: tempnam(): open_basedir restriction in effect. File(./../.) is not 
within the allowed path(s): (.) in %s on line %d
 bool(false)
+
+Warning: tempnam(): open_basedir restriction in effect. File() is not within 
the allowed path(s): (.) in %s on line %d
+bool(false)
+string(%d) "%s"
+bool(true)
+string(%d) "%s"
+bool(true)
 string(%d) "%s"
 bool(true)
 *** Finished testing open_basedir configuration [tempnam] ***
http://cvs.php.net/viewvc.cgi/php-src/tests/security/open_basedir_opendir.phpt?r1=1.1.4.3&r2=1.1.4.4&diff_format=u
Index: php-src/tests/security/open_basedir_opendir.phpt
diff -u php-src/tests/security/open_basedir_opendir.phpt:1.1.4.3 
php-src/tests/security/open_basedir_opendir.phpt:1.1.4.4
--- php-src/tests/security/open_basedir_opendir.phpt:1.1.4.3    Sun Sep  7 
22:34:40 2008
+++ php-src/tests/security/open_basedir_opendir.phpt    Thu Jan 22 07:56:56 2009
@@ -5,13 +5,13 @@
 --FILE--
 <?php
 require_once "open_basedir.inc";
+$initdir = getcwd();
 test_open_basedir_before("opendir");
 test_open_basedir_error("opendir");     
 
-$directory = dirname(__FILE__);
-var_dump(opendir($directory."/test/ok/"));
-var_dump(opendir($directory."/test/ok"));
-var_dump(opendir($directory."/test/ok/../ok"));
+var_dump(opendir($initdir."/test/ok/"));
+var_dump(opendir($initdir."/test/ok"));
+var_dump(opendir($initdir."/test/ok/../ok"));
 
 test_open_basedir_after("opendir");?>
 --CLEAN--
http://cvs.php.net/viewvc.cgi/php-src/tests/security/open_basedir_copy_variation1.phpt?r1=1.1.4.2&r2=1.1.4.3&diff_format=u
Index: php-src/tests/security/open_basedir_copy_variation1.phpt
diff -u php-src/tests/security/open_basedir_copy_variation1.phpt:1.1.4.2 
php-src/tests/security/open_basedir_copy_variation1.phpt:1.1.4.3
--- php-src/tests/security/open_basedir_copy_variation1.phpt:1.1.4.2    Fri May 
 9 08:39:44 2008
+++ php-src/tests/security/open_basedir_copy_variation1.phpt    Thu Jan 22 
07:56:56 2009
@@ -6,7 +6,6 @@
 <?php
 require_once "open_basedir.inc";
 test_open_basedir_before("copy");
-$directory = dirname(__FILE__);
 
 var_dump(copy("../bad/bad.txt", "copy.txt"));
 var_dump(unlink("copy.txt"));
http://cvs.php.net/viewvc.cgi/php-src/tests/security/open_basedir_copy.phpt?r1=1.1.4.3&r2=1.1.4.4&diff_format=u
Index: php-src/tests/security/open_basedir_copy.phpt
diff -u php-src/tests/security/open_basedir_copy.phpt:1.1.4.3 
php-src/tests/security/open_basedir_copy.phpt:1.1.4.4
--- php-src/tests/security/open_basedir_copy.phpt:1.1.4.3       Sun Sep  7 
22:34:39 2008
+++ php-src/tests/security/open_basedir_copy.phpt       Thu Jan 22 07:56:56 2009
@@ -6,7 +6,6 @@
 <?php
 require_once "open_basedir.inc";
 test_open_basedir_before("copy");
-$directory = dirname(__FILE__);
 
 var_dump(copy("ok.txt", "../bad"));
 var_dump(copy("ok.txt", "../bad/bad.txt"));
http://cvs.php.net/viewvc.cgi/php-src/tests/security/open_basedir_unlink.phpt?r1=1.1.4.2&r2=1.1.4.3&diff_format=u
Index: php-src/tests/security/open_basedir_unlink.phpt
diff -u php-src/tests/security/open_basedir_unlink.phpt:1.1.4.2 
php-src/tests/security/open_basedir_unlink.phpt:1.1.4.3
--- php-src/tests/security/open_basedir_unlink.phpt:1.1.4.2     Fri May  9 
08:39:44 2008
+++ php-src/tests/security/open_basedir_unlink.phpt     Thu Jan 22 07:56:56 2009
@@ -5,14 +5,14 @@
 --FILE--
 <?php
 require_once "open_basedir.inc";
+$initdir = getcwd();
 test_open_basedir_before("unlink");
-$directory = dirname(__FILE__);
 
 var_dump(unlink("../bad/bad.txt"));
 var_dump(unlink(".././bad/bad.txt"));
 var_dump(unlink("../bad/../bad/bad.txt"));
 var_dump(unlink("./.././bad/bad.txt"));
-var_dump(unlink($directory."/test/bad/bad.txt"));
+var_dump(unlink($initdir."/test/bad/bad.txt"));
 
 test_open_basedir_after("unlink");
 ?>
http://cvs.php.net/viewvc.cgi/php-src/tests/security/open_basedir_file.phpt?r1=1.1.4.3&r2=1.1.4.4&diff_format=u
Index: php-src/tests/security/open_basedir_file.phpt
diff -u php-src/tests/security/open_basedir_file.phpt:1.1.4.3 
php-src/tests/security/open_basedir_file.phpt:1.1.4.4
--- php-src/tests/security/open_basedir_file.phpt:1.1.4.3       Sun Sep  7 
22:34:39 2008
+++ php-src/tests/security/open_basedir_file.phpt       Thu Jan 22 07:56:56 2009
@@ -5,14 +5,14 @@
 --FILE--
 <?php
 require_once "open_basedir.inc";
-$directory = dirname(__FILE__);
+$initdir = getcwd();
 test_open_basedir_before("file");
 test_open_basedir_error("file");
      
 var_dump(file("ok.txt"));
 var_dump(file("../ok/ok.txt"));
-var_dump(file($directory."/test/ok/ok.txt"));
-var_dump(file($directory."/test/ok/../ok/ok.txt"));
+var_dump(file($initdir."/test/ok/ok.txt"));
+var_dump(file($initdir."/test/ok/../ok/ok.txt"));
 
 test_open_basedir_after("file");
 ?>

http://cvs.php.net/viewvc.cgi/php-src/tests/security/open_basedir_glob_variation.phpt?view=markup&rev=1.1
Index: php-src/tests/security/open_basedir_glob_variation.phpt
+++ php-src/tests/security/open_basedir_glob_variation.phpt

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to