mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +02:00

Extract root check into skipif_root.inc to share this commonly repeated logic. Closes GH-4779.
16 lines
341 B
PHP
16 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');
|
|
}
|
|
|