summaryrefslogtreecommitdiff
path: root/ext/pcntl/tests/pcntl_unshare_01.phpt
blob: fcbf112e4d6f4457eff4831504e2102a030dbf00 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
--TEST--
pcntl_unshare() with CLONE_NEWUSER
--SKIPIF--
<?php
if (!extension_loaded("pcntl")) die("skip");
if (!extension_loaded("posix")) die("skip posix extension not available");
if (!function_exists("pcntl_unshare")) die("skip pcntl_unshare is not available");
if (!defined("CLONE_NEWUSER")) die("skip flag unavailable");
if (@pcntl_unshare(CLONE_NEWUSER) == false && pcntl_get_last_error() == PCNTL_EPERM) {
    die("skip Insufficient privileges to use CLONE_NEWUSER");
}
?>
--FILE--
<?php

$olduid = posix_getuid();
pcntl_unshare(CLONE_NEWUSER);
$newuid = posix_getuid();
var_dump($olduid === $newuid);
?>
--EXPECT--
bool(false)