1--TEST--
2pcntl_setns()
3--EXTENSIONS--
4pcntl
5posix
6--SKIPIF--
7<?php
8if (!function_exists("pcntl_setns")) die("skip pcntl_setns is not available");
9if (getenv('SKIP_ASAN')) die('skip Timeouts under ASAN');
10
11$pid = pcntl_fork();
12if ($pid == -1) die("skip pcntl_fork failed");
13if ($pid != 0) {
14    if (@pcntl_setns($pid, CLONE_NEWPID) === false && pcntl_get_last_error() == PCNTL_EPERM) {
15        die("skip Insufficient privileges to use pcntl_setns()");
16    }
17}
18?>
19--FILE--
20<?php
21$pid = pcntl_fork();
22if ($pid == -1) die("pcntl_fork failed");
23if ($pid != 0) {
24	try {
25		pcntl_setns($pid, 0);
26	} catch (\ValueError $e) {
27		echo $e->getMessage();
28	}
29}
30?>
31--EXPECTF--
32pcntl_setns(): Argument #2 ($nstype) is an invalid nstype (%d)
33