Skip to content

Commit ec3ee30

Browse files
author
Zoe Slattery
committed
added skipif for root
1 parent 92f17ed commit ec3ee30

5 files changed

+55
-0
lines changed

ext/standard/tests/file/is_executable_variation2.phpt

+11
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@ Test is_executable() function: usage variations - file/dir with diff. perms
55
if (substr(PHP_OS, 0, 3) == 'WIN') {
66
die('skip not for windows');
77
}
8+
// Skip if being run by root
9+
$filename = dirname(__FILE__)."/is_readable_root_check.tmp";
10+
$fp = fopen($filename, 'w');
11+
fclose($fp);
12+
if(fileowner($filename) == 0) {
13+
unlink ($filename);
14+
die('skip cannot be run as root');
15+
}
16+
17+
unlink($filename);
18+
819
?>
920
--FILE--
1021
<?php

ext/standard/tests/file/is_readable_variation2.phpt

+11
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@ Test is_readable() function: usage variations - file/dir with diff. perms
55
if (substr(PHP_OS, 0, 3) == 'WIN') {
66
die('skip not for windows');
77
}
8+
// Skip if being run by root
9+
$filename = dirname(__FILE__)."/is_readable_root_check.tmp";
10+
$fp = fopen($filename, 'w');
11+
fclose($fp);
12+
if(fileowner($filename) == 0) {
13+
unlink ($filename);
14+
die('skip cannot be run as root');
15+
}
16+
17+
unlink($filename);
18+
819
?>
920
--FILE--
1021
<?php

ext/standard/tests/file/is_writable_variation2.phpt

+11
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@ Test is_writable() and its alias is_writeable() function: usage variations - fil
55
if (substr(PHP_OS, 0, 3) == 'WIN') {
66
die('skip.. only on LINUX');
77
}
8+
// Skip if being run by root
9+
$filename = dirname(__FILE__)."/is_readable_root_check.tmp";
10+
$fp = fopen($filename, 'w');
11+
fclose($fp);
12+
if(fileowner($filename) == 0) {
13+
unlink ($filename);
14+
die('skip cannot be run as root');
15+
}
16+
17+
unlink($filename);
18+
819
?>
920
--FILE--
1021
<?php

ext/standard/tests/file/lchown_error.phpt

+11
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ Test lchown() function : error functionality
44
<?php
55
if (substr(PHP_OS, 0, 3) == 'WIN') die('skip no windows support');
66
if (!function_exists("posix_getuid")) die("skip no posix_getuid()");
7+
// Skip if being run by root
8+
$filename = dirname(__FILE__)."/is_readable_root_check.tmp";
9+
$fp = fopen($filename, 'w');
10+
fclose($fp);
11+
if(fileowner($filename) == 0) {
12+
unlink ($filename);
13+
die('skip cannot be run as root');
14+
}
15+
16+
unlink($filename);
17+
718
?>
819
--FILE--
920
<?php

ext/standard/tests/file/tempnam_variation4.phpt

+11
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@ Test tempnam() function: usage variations - permissions(0000 to 0777) of dir
55
if (substr(PHP_OS, 0, 3) == 'WIN') {
66
die('skip Not valid for Windows');
77
}
8+
// Skip if being run by root
9+
$filename = dirname(__FILE__)."/is_readable_root_check.tmp";
10+
$fp = fopen($filename, 'w');
11+
fclose($fp);
12+
if(fileowner($filename) == 0) {
13+
unlink ($filename);
14+
die('skip cannot be run as root');
15+
}
16+
17+
unlink($filename);
18+
819
?>
920
--FILE--
1021
<?php

0 commit comments

Comments
 (0)