You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If anyone is trying to optionally use either pcntl_async_signals() when available (PHP >= 7.1) or ticks for older versions, this is not possible...at least not in a way that does NOT enable ticks for newer PHP versions. This is because there is simply no way to conditionally declare ticks. For example, the following will "work" but not in the way you might expect:
if (function_exists('pcntl_async_signals')) {
pcntl_async_signals(true);
} else {
declare(ticks=1);
}
While signal handlers will work with this for old and new version, ticks WILL be enabled even in the case where pcntl_async_signals exists, simply because the declare statement exists.
I was reading the docs on pcntl_async_signals and found a comment on this page:
https://www.php.net/manual/en/control-structures.declare.php
If anyone is trying to optionally use either pcntl_async_signals() when available (PHP >= 7.1) or ticks for older versions, this is not possible...at least not in a way that does NOT enable ticks for newer PHP versions. This is because there is simply no way to conditionally declare ticks. For example, the following will "work" but not in the way you might expect:
While signal handlers will work with this for old and new version, ticks WILL be enabled even in the case where pcntl_async_signals exists, simply because the declare statement exists.
Then I stumbled on identical code in this repo:
https://github.com/Seldaek/signal-handler/blob/main/src/SignalHandler.php#L260
The text was updated successfully, but these errors were encountered: