Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions lib/PhpStatistics.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,23 @@ protected function getAPCuStatus(): array {
}

/**
* Get all loaded php extensions
* Get all loaded php extensions (PHP + Zend), de-duplicated and sorted.
*
* @return array|null of strings with the names of the loaded extensions
* @return array|null array of extension names, or null if PHP forbids enumeration
*/
protected function getLoadedPhpExtensions(): ?array {
if (!function_exists('get_loaded_extensions')) {
return null;
}
$extensions = get_loaded_extensions();

// `get_loaded_extensions(true)` returns Zend extensions (OPcache, Xdebug, etc.)
// which are otherwise hidden from the regular call.
$extensions = array_merge(
get_loaded_extensions(false),
get_loaded_extensions(true)
);

$extensions = array_unique(array_map('strtolower', $extensions));
natcasesort($extensions);

return $extensions;
Expand Down
Loading