diff options
Diffstat (limited to 'ext/standard/tests/skipif_root.inc')
| -rw-r--r-- | ext/standard/tests/skipif_root.inc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/ext/standard/tests/skipif_root.inc b/ext/standard/tests/skipif_root.inc new file mode 100644 index 0000000000..d43cae8674 --- /dev/null +++ b/ext/standard/tests/skipif_root.inc @@ -0,0 +1,16 @@ +<?php + +// Skip if being run by root (files are always readable, writeable and executable) +$filename = @tempnam(__DIR__, 'root_check_'); +if (!file_exists($filename)) { + die('WARN Unable to create the "root check" file'); +} + +$isRoot = fileowner($filename) == 0; + +unlink($filename); + +if ($isRoot) { + die('SKIP Cannot be run as root'); +} + |
