]> granicus.if.org Git - php/commitdiff
added skip if for root
authorZoe Slattery <zoe@php.net>
Fri, 20 Mar 2009 08:58:09 +0000 (08:58 +0000)
committerZoe Slattery <zoe@php.net>
Fri, 20 Mar 2009 08:58:09 +0000 (08:58 +0000)
ext/standard/tests/file/is_executable_variation2.phpt
ext/standard/tests/file/is_readable_variation2.phpt
ext/standard/tests/file/is_writable_variation2.phpt
ext/standard/tests/file/lchown_error.phpt
ext/standard/tests/file/tempnam_variation4.phpt

index 1235ec134f2796dd82f49a0ecaecd5af850e6498..fc804d652aa8b0ce5616028c2a04605fcae030b9 100644 (file)
@@ -5,6 +5,16 @@ Test is_executable() function: usage variations - file/dir with diff. perms
 if (substr(PHP_OS, 0, 3) == 'WIN') {
     die('skip not for windows');
 }
+// Skip if being run by root 
+$filename = dirname(__FILE__)."/is_readable_root_check.tmp";
+$fp = fopen($filename, 'w');
+fclose($fp);
+if(fileowner($filename) == 0) {
+        unlink ($filename);
+        die('skip cannot be run as root');
+}
+
+unlink($filename);
 ?>
 --FILE--
 <?php
index 10178700285cbc02eb7f1b617f01b562406e0aee..e1faf559978cf07980d5f8b1c9abf47391e1b5ff 100644 (file)
@@ -5,6 +5,15 @@ Test is_readable() function: usage variations - file/dir with diff. perms
 if (substr(PHP_OS, 0, 3) == 'WIN') {
     die('skip not for windows');
 }
+// Skip if being run by root
+$filename = dirname(__FILE__)."/is_readable_root_check.tmp";
+$fp = fopen($filename, 'w');
+fclose($fp);
+if(fileowner($filename) == 0) {
+        unlink ($filename);
+        die('skip cannot be run as root');
+}
+unlink($filename);
 ?>
 --FILE--
 <?php
index 5fcbb5d4ae1925d4db3186d25005f49374c685a2..f56219ce400b1a621845b53d35f83876ae1ee173 100644 (file)
@@ -5,6 +5,16 @@ Test is_writable() and its alias is_writeable() function: usage variations - fil
 if (substr(PHP_OS, 0, 3) == 'WIN') {
     die('skip.. only on LINUX');
 }
+// Skip if being run by root
+$filename = dirname(__FILE__)."/is_readable_root_check.tmp";
+$fp = fopen($filename, 'w');
+fclose($fp);
+if(fileowner($filename) == 0) {
+        unlink ($filename);
+        die('skip cannot be run as root');
+}
+
+unlink ($filename);
 ?>
 --FILE--
 <?php
index 8908f46db39b1ce0e8ea0fe6adebfcb42572f2be..1e0356569c2a6aa67ee58e77c6abc5e2a7908e48 100644 (file)
@@ -4,6 +4,15 @@ Test lchown() function : error functionality
 <?php
 if (substr(PHP_OS, 0, 3) == 'WIN') die('skip no windows support');
 if (!function_exists("posix_getuid")) die("skip no posix_getuid()");
+// Skip if being run by root
+$filename = dirname(__FILE__)."/is_readable_root_check.tmp";
+$fp = fopen($filename, 'w');
+fclose($fp);
+if(fileowner($filename) == 0) {
+        unlink ($filename);
+        die('skip cannot be run as root');
+}
+unlink($filename);
 ?>
 --FILE--
 <?php
index 5525b584a9d9ca7627dff5a0f26e7d79596b086c..4ce1c7ec24b5eb9a787a25cc21b3e404e7b00580 100644 (file)
@@ -5,6 +5,15 @@ Test tempnam() function: usage variations - permissions(0000 to 0777) of dir
 if (substr(PHP_OS, 0, 3) == 'WIN') {
     die('skip Not valid for Windows');
 }
+// Skip if being run by root
+$filename = dirname(__FILE__)."/is_readable_root_check.tmp";
+$fp = fopen($filename, 'w');
+fclose($fp);
+if(fileowner($filename) == 0) {
+        unlink ($filename);
+        die('skip cannot be run as root');
+}
+unlink($filename);
 ?>
 --FILE--
 <?php