From a6911cbd4d33d2301e9be4ff43a947fcb5aa111d Mon Sep 17 00:00:00 2001 From: Mikhail Galanin <195510+mikhainin@users.noreply.github.com> Date: Thu, 8 Jun 2023 15:16:47 +0100 Subject: [PATCH] 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 --- ext/pcntl/tests/pcntl_unshare_03.phpt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/pcntl/tests/pcntl_unshare_03.phpt b/ext/pcntl/tests/pcntl_unshare_03.phpt index 56433c0ee93..567ff6b77b2 100644 --- a/ext/pcntl/tests/pcntl_unshare_03.phpt +++ b/ext/pcntl/tests/pcntl_unshare_03.phpt @@ -9,7 +9,7 @@ if (!function_exists("pcntl_unshare")) die("skip pcntl_unshare is not available" if (!defined("CLONE_NEWNET")) die("skip flag unavailable"); if (posix_getuid() !== 0 && (!defined("CLONE_NEWUSER") || - (pcntl_unshare(CLONE_NEWUSER) == false && pcntl_get_last_error() == PCNTL_EPERM))) { + (@pcntl_unshare(CLONE_NEWUSER) == false && pcntl_get_last_error() == PCNTL_EPERM))) { die("skip Insufficient privileges for CLONE_NEWUSER"); } if (@pcntl_unshare(CLONE_NEWNET) == false && pcntl_get_last_error() == PCNTL_EPERM) {