Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ext/pcntl/tests/async_signals_2.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ try {
array_fill(0, 360, 0)
);
} catch (Exception $e) {
echo $e->getMessage(), "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}

?>
--EXPECT--
Alarm!
Exception: Alarm!
12 changes: 6 additions & 6 deletions ext/pcntl/tests/bug81577.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ for ($i = 0; $i < 5; $i++) {
C::$a + C::$a;
posix_kill(posix_getpid(), SIGTERM) + C::$cond;
} catch (Throwable $ex) {
echo get_class($ex) , " : " , $ex->getMessage() , "\n";

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This (and following) safe us a function call; not style-only.

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
2 changes: 1 addition & 1 deletion ext/pcntl/tests/bug81577_2.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pcntl_signal(SIGTERM, function ($signo) {});
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);
?>
Expand Down
4 changes: 2 additions & 2 deletions ext/pcntl/tests/bug81577_3.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ pcntl_signal(SIGTERM, function ($signo) { throw new Exception("Signal"); });
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
4 changes: 2 additions & 2 deletions ext/pcntl/tests/gh16769.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ $a[0] = &$a;
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
12 changes: 6 additions & 6 deletions ext/pcntl/tests/pcntl_alarm_invalid_value.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,26 @@ pcntl
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)
8 changes: 4 additions & 4 deletions ext/pcntl/tests/pcntl_exec_004.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ if (!getenv("TEST_PHP_EXECUTABLE") || !is_executable(getenv("TEST_PHP_EXECUTABLE
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
4 changes: 2 additions & 2 deletions ext/pcntl/tests/pcntl_getpriority_error.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ if (PHP_OS == "Darwin") {
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
pcntl_getpriority(-1, PRIO_PROCESS);

?>
--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
4 changes: 2 additions & 2 deletions ext/pcntl/tests/pcntl_setpriority_error.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ if (PHP_OS == "Darwin") {
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
12 changes: 6 additions & 6 deletions ext/pcntl/tests/pcntl_signal.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@ var_dump(pcntl_signal(SIGALRM, SIG_IGN));
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 */
Expand All @@ -45,7 +45,7 @@ echo "ok\n";
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
4 changes: 2 additions & 2 deletions ext/pcntl/tests/pcntl_signal_001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ try {
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
4 changes: 2 additions & 2 deletions ext/pcntl/tests/pcntl_signal_002.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ pcntl
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
4 changes: 2 additions & 2 deletions ext/pcntl/tests/pcntl_signal_dispatch_exception.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ posix_kill(posix_getpid(), SIGUSR2);
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
36 changes: 18 additions & 18 deletions ext/pcntl/tests/pcntl_signal_functions_invalid_signals.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -16,65 +16,65 @@ max_execution_time=0
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
Loading