mirror of
https://github.com/php/php-src.git
synced 2024-09-22 10:27:25 +00:00
8b5c351154
Extract root check into skipif_root.inc to share this commonly repeated logic. Closes GH-4779.
17 lines
341 B
PHP
17 lines
341 B
PHP
<?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');
|
|
}
|
|
|