summaryrefslogtreecommitdiff
path: root/ext/standard/tests/skipif_root.inc
blob: d43cae86744695b401cd6c8721f1c36bb914a84e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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');
}