1
0
Fork 0
mirror of https://github.com/mlocati/docker-php-extension-installer synced 2025-05-08 16:17:20 +00:00

Add support for SourceGuardian Loader (#442)

This commit is contained in:
Michele Locati 2021-09-28 11:44:47 +02:00 committed by GitHub
parent 872d4e5302
commit f9cf2dedc3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 76 additions and 4 deletions

30
scripts/tests/sourceguardian Executable file
View file

@ -0,0 +1,30 @@
#!/usr/bin/env php
<?php
set_error_handler(
static function ($errno, $errstr, $errfile, $errline) {
$msg = "Error {$errno}: {$errstr}\n";
if ($errfile) {
$msg .= "File: {$errfile}\n";
if ($errline) {
$msg .= "Line: {$errline}\n";
}
}
fwrite(STDERR, $msg);
exit(1);
},
-1
);
$rc = 0;
foreach ([false => 'PHP module', true => 'Zend extension'] as $type => $typeName) {
$extensions = get_loaded_extensions($type);
$extensionsLowerCase = array_map('strtolower', $extensions);
if (in_array('sourceguardian', $extensionsLowerCase, true)) {
fwrite(STDOUT, "The SourceGuardian {$typeName} is loaded.\n");
} else {
fwrite(STDERR, "The SourceGuardian {$typeName} is not loaded.\nLoaded extensions are: \n- " . implode("\n- ", $extensions));
$rc = 1;
}
}
exit($rc);