From f7b3fb5f71e1cae91606594753f569ef09defd40 Mon Sep 17 00:00:00 2001 From: Beu Date: Sat, 23 Dec 2023 21:10:31 +0100 Subject: [PATCH] fix error when pcntl extension is not loaded --- ManiaControl.php | 4 +++- core/ManiaControl.php | 8 +++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ManiaControl.php b/ManiaControl.php index 25a659be..65b79761 100644 --- a/ManiaControl.php +++ b/ManiaControl.php @@ -29,7 +29,9 @@ if (!ini_get('date.timezone') && function_exists('date_default_timezone_set')) { gc_enable(); // Listen process signals -pcntl_async_signals(true); +if (extension_loaded('pcntl')) { + pcntl_async_signals(true); +} // Register AutoLoader require_once MANIACONTROL_PATH . 'core' . DIRECTORY_SEPARATOR . 'AutoLoader.php'; diff --git a/core/ManiaControl.php b/core/ManiaControl.php index 944c6488..273b3e4f 100644 --- a/core/ManiaControl.php +++ b/core/ManiaControl.php @@ -653,9 +653,11 @@ class ManiaControl implements CallbackListener, CommandListener, TimerListener, try { // Manage SIGTERM signal - pcntl_signal(SIGTERM, function() { - $this->quit("Stop signal received from the OS.", false); - }); + if (extension_loaded('pcntl')) { + pcntl_signal(SIGTERM, function() { + $this->quit("Stop signal received from the OS.", false); + }); + } // Connect to server $this->connect();