1
0
Fork 0
mirror of https://github.com/mlocati/docker-php-extension-installer synced 2025-05-09 00:22:40 +00:00

Add support to UOPZ

uopz disables exit() by default, so we can't assume that exit()
will actually quit a PHP script
This commit is contained in:
Michele Locati 2019-09-27 17:29:02 +02:00
parent 21f8edbea2
commit 25a58a500f
No known key found for this signature in database
GPG key ID: 98B7CE2E7234E28B
3 changed files with 26 additions and 14 deletions

View file

@ -1,22 +1,24 @@
<?php
$extension = isset($argv[1]) ? trim($argv[1]) : '';
$rc = 1;
if ($extension === '') {
fprintf(STDERR, "Missing module handle.\n");
exit(1);
}
$nameMap = array(
'opcache' => 'Zend OPcache',
);
$extensionLowerCase = strtolower($extension);
if (isset($nameMap[$extensionLowerCase])) {
$extension = $nameMap[$extensionLowerCase];
} else {
$nameMap = array(
'opcache' => 'Zend OPcache',
);
$extensionLowerCase = strtolower($extension);
if (isset($nameMap[$extensionLowerCase])) {
$extension = $nameMap[$extensionLowerCase];
}
if (!extension_loaded($extension)) {
fprintf(STDERR, sprintf("Extension not loaded: %s\n", $extension));
} else {
fprintf(STDOUT, sprintf("Extension correctly loaded: %s\n", $extension));
$rc = 0;
}
}
if (extension_loaded($extension)) {
fprintf(STDOUT, sprintf("Extension correctly loaded: %s\n", $extension));
exit(0);
}
fprintf(STDERR, sprintf("Extension not loaded: %s\n", $extension));
exit(1);
exit($rc);