]> 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 15:40:06 +0000 (15:40 +0000)
committerZoe Slattery <zoe@php.net>
Thu, 14 Jun 2007 15:40:06 +0000 (15:40 +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 091aca7d78e2f5f6d195ff6bf464e41d6aa11325..895f16e1e0991a75d030e85e53579ae6e41b66e4 100644 (file)
@@ -5,6 +5,17 @@ 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 c346150e0c855e2a91253b4eabdff722c5fc2ecd..9e4a32cfeb23b2e3ac1f5636437b46bab21ff778 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 f5910e6a6b8ed8a99fae7be2ef82a12ec5a80f6f..f656f3d16d4ce40a0153a7f99b88dbdc4c565cba 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 68c3bcb8ae07f83d722acee639e0a3d90b96f577..ee4a51d09a8ff6ef88df09f722365d9516ae7c64 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 0576e738b5e1a4d4763b24171e65d9e249c6a0bd..27d14dd07036f7e7414be2a334f49f960b907576 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 b19df2daf31f693833f6bee4632fdfddc2b9e6d4..e46aaa30b87385908d8e184c9dd1c7d26d5ef3dd 100644 (file)
@@ -4,7 +4,17 @@ Test is_writable() and its alias is_writeable() function: usage variations
 <?php
 if (substr(PHP_OS, 0, 3) == 'WIN') {
     die('skip.. only on 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 9d1f1e2f44ef03daddd2a7ba3694d8a22654b411..89faf9c414f831753faef0e49299f74acc43b4a4 100644 (file)
@@ -5,6 +5,16 @@ Test mkdir() and rmdir() functions: usage variations
 if (substr(PHP_OS, 0, 3) == 'WIN') {
     die('skip.. only on 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