Commit a3a6c779391 for php.net

commit a3a6c7793919fb4912b7358eaa33970af473d833
Author: NickSdot <32384907+NickSdot@users.noreply.github.com>
Date:   Fri Aug 14 16:20:34 2026 +0700

    ext/pcntl: applied fixers to improve test robustness (#23037)

diff --git a/ext/pcntl/tests/async_signals_2.phpt b/ext/pcntl/tests/async_signals_2.phpt
index 95a5a219768..f94a8881ee0 100644
--- a/ext/pcntl/tests/async_signals_2.phpt
+++ b/ext/pcntl/tests/async_signals_2.phpt
@@ -22,9 +22,9 @@
         array_fill(0, 360, 0)
     );
 } catch (Exception $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 ?>
 --EXPECT--
-Alarm!
+Exception: Alarm!
diff --git a/ext/pcntl/tests/bug81577.phpt b/ext/pcntl/tests/bug81577.phpt
index 7bf3b7ffea4..557e719bd8a 100644
--- a/ext/pcntl/tests/bug81577.phpt
+++ b/ext/pcntl/tests/bug81577.phpt
@@ -19,13 +19,13 @@ class C {
 		C::$a + C::$a;
 		posix_kill(posix_getpid(), SIGTERM) + C::$cond;
 	} catch (Throwable $ex) {
-		echo get_class($ex) , " : " , $ex->getMessage() , "\n";
+		echo $ex::class, ': ', $ex->getMessage(), "\n";
 	}
 }
 ?>
 --EXPECT--
-Exception : Signal
-Exception : Signal
-Exception : Signal
-Exception : Signal
-Exception : Signal
+Exception: Signal
+Exception: Signal
+Exception: Signal
+Exception: Signal
+Exception: Signal
diff --git a/ext/pcntl/tests/bug81577_2.phpt b/ext/pcntl/tests/bug81577_2.phpt
index 2f92502df53..c77617dfb78 100644
--- a/ext/pcntl/tests/bug81577_2.phpt
+++ b/ext/pcntl/tests/bug81577_2.phpt
@@ -10,7 +10,7 @@
 try {
 	$a = [1, posix_kill(posix_getpid(), SIGTERM), 2];
 } catch (Throwable $ex) {
-	echo get_class($ex) , " : " , $ex->getMessage() , "\n";
+	echo $ex::class, ': ', $ex->getMessage(), "\n";
 }
 var_dump($a);
 ?>
diff --git a/ext/pcntl/tests/bug81577_3.phpt b/ext/pcntl/tests/bug81577_3.phpt
index 1a30deaebaa..c50a04d68a4 100644
--- a/ext/pcntl/tests/bug81577_3.phpt
+++ b/ext/pcntl/tests/bug81577_3.phpt
@@ -12,8 +12,8 @@
 try {
 	array_merge([1], [2]) + posix_kill(posix_getpid(), SIGTERM);
 } catch (Throwable $ex) {
-	echo get_class($ex) , " : " , $ex->getMessage() , "\n";
+	echo $ex::class, ': ', $ex->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-Exception : Signal
+Exception: Signal
diff --git a/ext/pcntl/tests/gh16769.phpt b/ext/pcntl/tests/gh16769.phpt
index 60baee61610..5f9383882f8 100644
--- a/ext/pcntl/tests/gh16769.phpt
+++ b/ext/pcntl/tests/gh16769.phpt
@@ -11,8 +11,8 @@
 try {
 	pcntl_sigwaitinfo($a,$a);
 } catch(\TypeError $e) {
-	echo $e->getMessage();
+	echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 ?>
 --EXPECT--
-pcntl_sigwaitinfo(): Argument #1 ($signals) signals must be of type int, array given
+TypeError: pcntl_sigwaitinfo(): Argument #1 ($signals) signals must be of type int, array given
diff --git a/ext/pcntl/tests/pcntl_alarm_invalid_value.phpt b/ext/pcntl/tests/pcntl_alarm_invalid_value.phpt
index 59e74662f6f..cc53a3ee04f 100644
--- a/ext/pcntl/tests/pcntl_alarm_invalid_value.phpt
+++ b/ext/pcntl/tests/pcntl_alarm_invalid_value.phpt
@@ -10,26 +10,26 @@
 try {
     pcntl_alarm(-1);
 } catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 try {
     pcntl_alarm(PHP_INT_MIN);
 } catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 try {
     pcntl_alarm(PHP_INT_MAX);
 } catch (\ValueError $e) {
-    echo $e->getMessage() . \PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 var_dump(pcntl_alarm(0));

 ?>
 --EXPECTF--
-pcntl_alarm(): Argument #1 ($seconds) must be between 0 and %d
-pcntl_alarm(): Argument #1 ($seconds) must be between 0 and %d
-pcntl_alarm(): Argument #1 ($seconds) must be between 0 and %d
+ValueError: pcntl_alarm(): Argument #1 ($seconds) must be between 0 and %d
+ValueError: pcntl_alarm(): Argument #1 ($seconds) must be between 0 and %d
+ValueError: pcntl_alarm(): Argument #1 ($seconds) must be between 0 and %d
 int(0)
diff --git a/ext/pcntl/tests/pcntl_exec_004.phpt b/ext/pcntl/tests/pcntl_exec_004.phpt
index 270fdb755ca..932a6a0277e 100644
--- a/ext/pcntl/tests/pcntl_exec_004.phpt
+++ b/ext/pcntl/tests/pcntl_exec_004.phpt
@@ -11,15 +11,15 @@
 try {
     pcntl_exec(getenv("TEST_PHP_EXECUTABLE"), ['-n', new stdClass()]);
 } catch (Error $error) {
-    echo $error->getMessage() . "\n";
+    echo $error::class, ': ', $error->getMessage(), "\n";
 }

 try {
     pcntl_exec(getenv("TEST_PHP_EXECUTABLE"), ['-n'], [new stdClass()]);
 } catch (Error $error) {
-    echo $error->getMessage() . "\n";
+    echo $error::class, ': ', $error->getMessage(), "\n";
 }
 ?>
 --EXPECT--
-Object of class stdClass could not be converted to string
-Object of class stdClass could not be converted to string
+Error: Object of class stdClass could not be converted to string
+Error: Object of class stdClass could not be converted to string
diff --git a/ext/pcntl/tests/pcntl_getpriority_error.phpt b/ext/pcntl/tests/pcntl_getpriority_error.phpt
index 2fa88a76842..3ca9243dddf 100644
--- a/ext/pcntl/tests/pcntl_getpriority_error.phpt
+++ b/ext/pcntl/tests/pcntl_getpriority_error.phpt
@@ -23,7 +23,7 @@
 try {
     pcntl_getpriority(null, PRIO_PGRP + PRIO_USER + PRIO_PROCESS + 10);
 } catch (ValueError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 // Different behavior in MacOS than rest of operating systems
@@ -31,6 +31,6 @@

 ?>
 --EXPECTF--
-pcntl_getpriority(): Argument #2 ($mode) must be one of PRIO_PGRP, PRIO_USER, or PRIO_PROCESS
+ValueError: pcntl_getpriority(): Argument #2 ($mode) must be one of PRIO_PGRP, PRIO_USER, or PRIO_PROCESS

 Warning: pcntl_getpriority(): Error %d: No process was located using the given parameters in %s
diff --git a/ext/pcntl/tests/pcntl_setpriority_error.phpt b/ext/pcntl/tests/pcntl_setpriority_error.phpt
index 6f0a67977a8..1c40d747602 100644
--- a/ext/pcntl/tests/pcntl_setpriority_error.phpt
+++ b/ext/pcntl/tests/pcntl_setpriority_error.phpt
@@ -23,13 +23,13 @@
 try {
     $result = pcntl_setpriority(0, null, (PRIO_PGRP + PRIO_USER + PRIO_PROCESS + 10));
 } catch (ValueError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 pcntl_setpriority(0, -123);

 ?>
 --EXPECTF--
-pcntl_setpriority(): Argument #3 ($mode) must be one of PRIO_PGRP, PRIO_USER, or PRIO_PROCESS
+ValueError: pcntl_setpriority(): Argument #3 ($mode) must be one of PRIO_PGRP, PRIO_USER, or PRIO_PROCESS

 Warning: pcntl_setpriority(): Error 3: No process was located using the given parameters in %s
diff --git a/ext/pcntl/tests/pcntl_signal.phpt b/ext/pcntl/tests/pcntl_signal.phpt
index 2e65139e393..f4ae1ef07e1 100644
--- a/ext/pcntl/tests/pcntl_signal.phpt
+++ b/ext/pcntl/tests/pcntl_signal.phpt
@@ -22,19 +22,19 @@
 try {
     pcntl_signal(-1, -1);
 } catch (ValueError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 try {
     pcntl_signal(-1, function(){});
 } catch (ValueError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 try {
     pcntl_signal(SIGALRM, "not callable");
 } catch (TypeError $exception) {
-    echo $exception->getMessage() . "\n";
+    echo $exception::class, ': ', $exception->getMessage(), "\n";
 }

 /* test freeing queue in RSHUTDOWN */
@@ -45,7 +45,7 @@
 signal dispatched
 got signal from %r\d+|nobody%r
 bool(true)
-pcntl_signal(): Argument #1 ($signal) must be greater than or equal to 1
-pcntl_signal(): Argument #1 ($signal) must be greater than or equal to 1
-pcntl_signal(): Argument #2 ($handler) must be of type callable|int, string given
+ValueError: pcntl_signal(): Argument #1 ($signal) must be greater than or equal to 1
+ValueError: pcntl_signal(): Argument #1 ($signal) must be greater than or equal to 1
+TypeError: pcntl_signal(): Argument #2 ($handler) must be of type callable|int, string given
 ok
diff --git a/ext/pcntl/tests/pcntl_signal_001.phpt b/ext/pcntl/tests/pcntl_signal_001.phpt
index 2f4f385553a..0b9a0f1d357 100644
--- a/ext/pcntl/tests/pcntl_signal_001.phpt
+++ b/ext/pcntl/tests/pcntl_signal_001.phpt
@@ -9,8 +9,8 @@
         echo "signaled\n";
     });
 } catch (Error $e) {
-    echo $e->getMessage();
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }
 ?>
 --EXPECTF--
-pcntl_signal(): Argument #1 ($signal) must be less than %d
+ValueError: pcntl_signal(): Argument #1 ($signal) must be less than %d
diff --git a/ext/pcntl/tests/pcntl_signal_002.phpt b/ext/pcntl/tests/pcntl_signal_002.phpt
index 1d4e29d94a7..f98392205e2 100644
--- a/ext/pcntl/tests/pcntl_signal_002.phpt
+++ b/ext/pcntl/tests/pcntl_signal_002.phpt
@@ -8,9 +8,9 @@
 try {
     pcntl_signal(SIGTERM, -1);
 } catch (Error $error) {
-    echo $error->getMessage();
+    echo $error::class, ': ', $error->getMessage(), PHP_EOL;
 }

 ?>
 --EXPECT--
-pcntl_signal(): Argument #2 ($handler) must be either SIG_DFL or SIG_IGN when an integer value is given
+ValueError: pcntl_signal(): Argument #2 ($handler) must be either SIG_DFL or SIG_IGN when an integer value is given
diff --git a/ext/pcntl/tests/pcntl_signal_dispatch_exception.phpt b/ext/pcntl/tests/pcntl_signal_dispatch_exception.phpt
index 06c4f827c6e..1558b7556d2 100644
--- a/ext/pcntl/tests/pcntl_signal_dispatch_exception.phpt
+++ b/ext/pcntl/tests/pcntl_signal_dispatch_exception.phpt
@@ -23,12 +23,12 @@
 try {
     pcntl_signal_dispatch();
 } catch (\Exception $e) {
-    echo $e->getMessage() . "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }

 echo "Handlers called: " . implode(', ', $called) . "\n";

 ?>
 --EXPECT--
-Exception in signal handler
+Exception: Exception in signal handler
 Handlers called: SIGUSR1
diff --git a/ext/pcntl/tests/pcntl_signal_functions_invalid_signals.phpt b/ext/pcntl/tests/pcntl_signal_functions_invalid_signals.phpt
index e61b17bf3fb..bd7e22e6634 100644
--- a/ext/pcntl/tests/pcntl_signal_functions_invalid_signals.phpt
+++ b/ext/pcntl/tests/pcntl_signal_functions_invalid_signals.phpt
@@ -16,65 +16,65 @@
 try {
     pcntl_sigprocmask(SIG_BLOCK, ["not_a_signal"]);
 } catch (TypeError $e) {
-    echo $e->getMessage() . PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 try {
     pcntl_sigprocmask(SIG_BLOCK, [0]);
 } catch (ValueError $e) {
-    echo $e->getMessage() . PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 try {
     pcntl_sigprocmask(SIG_BLOCK, []);
 } catch (ValueError $e) {
-    echo $e->getMessage() . PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 try {
     pcntl_sigwaitinfo(["not_a_signal"]);
 } catch (TypeError $e) {
-    echo $e->getMessage() . PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 try {
     pcntl_sigwaitinfo([0]);
 } catch (ValueError $e) {
-    echo $e->getMessage() . PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 try {
     pcntl_sigwaitinfo([]);
 } catch (ValueError $e) {
-    echo $e->getMessage() . PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 try {
     pcntl_sigtimedwait(["not_a_signal"], $info, 1);
 } catch (TypeError $e) {
-    echo $e->getMessage() . PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 try {
     pcntl_sigtimedwait([0], $info, 1);
 } catch (ValueError $e) {
-    echo $e->getMessage() . PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 try {
     pcntl_sigtimedwait([], $info, 1);
 } catch (ValueError $e) {
-    echo $e->getMessage() . PHP_EOL;
+    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
 }

 ?>
 --EXPECTF--
-pcntl_sigprocmask(): Argument #2 ($signals) signals must be of type int, string given
-pcntl_sigprocmask(): Argument #2 ($signals) signals must be between 1 and %d
-pcntl_sigprocmask(): Argument #2 ($signals) must not be empty
-pcntl_sigwaitinfo(): Argument #1 ($signals) signals must be of type int, string given
-pcntl_sigwaitinfo(): Argument #1 ($signals) signals must be between 1 and %d
-pcntl_sigwaitinfo(): Argument #1 ($signals) must not be empty
-pcntl_sigtimedwait(): Argument #1 ($signals) signals must be of type int, string given
-pcntl_sigtimedwait(): Argument #1 ($signals) signals must be between 1 and %d
-pcntl_sigtimedwait(): Argument #1 ($signals) must not be empty
+TypeError: pcntl_sigprocmask(): Argument #2 ($signals) signals must be of type int, string given
+ValueError: pcntl_sigprocmask(): Argument #2 ($signals) signals must be between 1 and %d
+ValueError: pcntl_sigprocmask(): Argument #2 ($signals) must not be empty
+TypeError: pcntl_sigwaitinfo(): Argument #1 ($signals) signals must be of type int, string given
+ValueError: pcntl_sigwaitinfo(): Argument #1 ($signals) signals must be between 1 and %d
+ValueError: pcntl_sigwaitinfo(): Argument #1 ($signals) must not be empty
+TypeError: pcntl_sigtimedwait(): Argument #1 ($signals) signals must be of type int, string given
+ValueError: pcntl_sigtimedwait(): Argument #1 ($signals) signals must be between 1 and %d
+ValueError: pcntl_sigtimedwait(): Argument #1 ($signals) must not be empty