Only call sapi_windows_set_ctrl_handler() for CLI requests (#9771)

main
Brandon Kelly 3 years ago committed by GitHub
parent 44bb82b50f
commit 7652408829
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -405,7 +405,7 @@ EOT
} }
} }
// handler Ctrl+C for Windows on PHP 7.4+ // handler Ctrl+C for Windows on PHP 7.4+
if (function_exists('sapi_windows_set_ctrl_handler')) { if (function_exists('sapi_windows_set_ctrl_handler') && PHP_SAPI === 'cli') {
@mkdir($directory, 0777, true); @mkdir($directory, 0777, true);
if ($realDir = realpath($directory)) { if ($realDir = realpath($directory)) {
sapi_windows_set_ctrl_handler(function () use ($realDir) { sapi_windows_set_ctrl_handler(function () use ($realDir) {

@ -208,7 +208,7 @@ class InstallationManager
}; };
$handleInterruptsUnix = function_exists('pcntl_async_signals') && function_exists('pcntl_signal'); $handleInterruptsUnix = function_exists('pcntl_async_signals') && function_exists('pcntl_signal');
$handleInterruptsWindows = function_exists('sapi_windows_set_ctrl_handler'); $handleInterruptsWindows = function_exists('sapi_windows_set_ctrl_handler') && PHP_SAPI === 'cli';
$prevHandler = null; $prevHandler = null;
$windowsHandler = null; $windowsHandler = null;
if ($handleInterruptsUnix) { if ($handleInterruptsUnix) {

Loading…
Cancel
Save