xref: /php-src/ext/standard/tests/skipif_root.inc (revision 8b5c3511)
1<?php
2
3// Skip if being run by root (files are always readable, writeable and executable)
4$filename = @tempnam(__DIR__, 'root_check_');
5if (!file_exists($filename)) {
6    die('WARN Unable to create the "root check" file');
7}
8
9$isRoot = fileowner($filename) == 0;
10
11unlink($filename);
12
13if ($isRoot) {
14    die('SKIP Cannot be run as root');
15}
16
17