Merge pull request #2 from Wojciechem/main

fix: check that required extensions are enabled. Resolves #1
This commit is contained in:
Nader K. Rad 2022-09-14 22:22:22 +02:00 committed by GitHub
commit 5f2dee1e2d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

21
h-m-m
View file

@ -149,6 +149,10 @@ function shutdown()
exit;
}
if (false === check_required_extensions()) {
return 1;
}
register_shutdown_function("shutdown");
declare(ticks = 1);
pcntl_signal(SIGINT,"shutdown");
@ -2420,6 +2424,23 @@ function monitor_key_presses(&$mm)
}
}
function check_required_extensions(): bool
{
if (!function_exists('pcntl_signal')) {
echo 'Required extension pcntl is not enabled; please check your php installation!';
echo PHP_EOL;
return false;
}
if (!function_exists('mb_strlen')) {
echo 'Required extension mbstring is not enabled; please check your php installation!';
echo PHP_EOL;
return false;
}
return true;
}
// }}}
// {{{ main