]> granicus.if.org Git - php/commitdiff
Tests are not valid if run by root - adding check to skip is user is root.
authorZoe Slattery <zoe@php.net>
Thu, 14 Jun 2007 16:15:50 +0000 (16:15 +0000)
committerZoe Slattery <zoe@php.net>
Thu, 14 Jun 2007 16:15:50 +0000 (16:15 +0000)
ext/standard/tests/file/is_executable_basic.phpt
ext/standard/tests/file/is_executable_variation.phpt
ext/standard/tests/file/is_readable_basic.phpt
ext/standard/tests/file/is_readable_variation.phpt
ext/standard/tests/file/is_writable_basic.phpt
ext/standard/tests/file/is_writable_variation.phpt
ext/standard/tests/file/mkdir_rmdir_variation.phpt

index 9141a4af098dd8cf773c8f8ac147fc1cebe83b61..64f140edff74a30739bb330983f25dd6a8fc0893 100644 (file)
@@ -5,6 +5,16 @@ Test is_executable() function: basic functionality
 if (substr(PHP_OS, 0, 3) == 'WIN') {
     die('skip.. only for LINUX');
 }
+// Skip if being run by root (files are always readable, writeable and executable)
+$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\n');
+}
+
+unlink($filename);
 ?>
 --FILE--
 <?php
index 187adcbf74f0c877f9e48276d26fa56a0993bc05..df096588350be273ba0f4907bb50db75bdcb8d89 100644 (file)
@@ -5,6 +5,16 @@ Test is_executable() function: usage variations
 if (substr(PHP_OS, 0, 3) == 'WIN') {
     die('skip.. only for LINUX');
 }
+// Skip if being run by root (files are always readable, writeable and executable)
+$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\n');
+}
+
+unlink($filename);
 ?>
 --FILE--
 <?php
index d4535d5be9646fc8d182ebe2c65ccaf9eaeefb98..3b4068715aff0d477dcfa770e7b8dd36cc8e89e7 100644 (file)
@@ -5,6 +5,16 @@ Test is_readable() function: basic functionality
 if (substr(PHP_OS, 0, 3) == 'WIN') {
     die('skip.. only for LINUX');
 }
+// Skip if being run by root (files are always readable, writeable and executable)
+$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\n');
+}
+
+unlink($filename);
 ?>
 --FILE--
 <?php
index e1297a8f693d4a072688b13d61c35b133314a3f0..0477a1667a048236b5d6fee198f91add6496b780 100644 (file)
@@ -5,6 +5,16 @@ Test is_readable() function: usage variations
 if (substr(PHP_OS, 0, 3) == 'WIN') {
     die('skip.. only for LINUX');
 }
+// Skip if being run by root (files are always readable, writeable and executable)
+$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\n');
+}
+
+unlink($filename);
 ?>
 --FILE--
 <?php
index b244c543924d5f1183c5d24d40b52569bb2ca831..26a3eb979396415a67c3761c13ce6e7ff34e9810 100644 (file)
@@ -1,5 +1,18 @@
 --TEST--
 Test is_writable() and its alias is_writeable() function: basic functionality
+--SKIPIF--
+<?php
+// Skip if being run by root (files are always readable, writeable and executable)
+$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\n');
+}
+
+unlink($filename);
+?>
 --FILE--
 <?php
 /* Prototype: bool is_writable ( string $filename );
index 76453619d7c5e501381cf68a933394d80d62841d..498aa90d35fbf8b78d43047b93b5c38100367b22 100644 (file)
@@ -5,6 +5,16 @@ Test is_writable() and its alias is_writeable() function: usage variations
 if (substr(PHP_OS, 0, 3) == 'WIN') {
     die('skip.. only for LINUX');
 }
+// Skip if being run by root (files are always readable, writeable and executable)
+$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\n');
+}
+
+unlink($filename);
 ?>
 --FILE--
 <?php
index 26b929604c8c55ad6323704f3b86abc7ee78a661..372c07f2a2d26d877c4a2cb751d39daf834983e9 100644 (file)
@@ -5,6 +5,16 @@ Test mkdir() and rmdir() functions: usage variations
 if (substr(PHP_OS, 0, 3) == 'WIN') {
     die('skip.. only for LINUX');
 }
+// Skip if being run by root (files are always readable, writeable and executable)
+$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\n');
+}
+
+unlink($filename);
 ?>
 --FILE--
 <?php