Skip to content

Commit a6911cb

Browse files
authored
Suppress warning when the test run under non-root (#11400)
When we run the test under non-root user, the test gets BORKed with: Warning: pcntl_unshare(): Error 1: No privilege to use these flags in ext/pcntl/tests/pcntl_unshare_03.skip.php on line 8 skip Insufficient privileges for CLONE_NEWUSER It looks like for the root-user there is the similar warning which is already suppressed (see the following "skip"). Let us skip the test properly if we aren't able to execute it
1 parent d5ad751 commit a6911cb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ext/pcntl/tests/pcntl_unshare_03.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ if (!function_exists("pcntl_unshare")) die("skip pcntl_unshare is not available"
99
if (!defined("CLONE_NEWNET")) die("skip flag unavailable");
1010
if (posix_getuid() !== 0 &&
1111
(!defined("CLONE_NEWUSER") ||
12-
(pcntl_unshare(CLONE_NEWUSER) == false && pcntl_get_last_error() == PCNTL_EPERM))) {
12+
(@pcntl_unshare(CLONE_NEWUSER) == false && pcntl_get_last_error() == PCNTL_EPERM))) {
1313
die("skip Insufficient privileges for CLONE_NEWUSER");
1414
}
1515
if (@pcntl_unshare(CLONE_NEWNET) == false && pcntl_get_last_error() == PCNTL_EPERM) {

0 commit comments

Comments
 (0)