Skip to content

Commit 5d62764

Browse files
committed
fix(php): include Zend extensions in loaded extensions list
get_loaded_extensions(false) hides Zend extensions like OPcache and Xdebug. Combine the regular and Zend lists, dedupe, and sort so the admin overview reflects what is actually loaded. Signed-off-by: Frank Karlitschek <frank@nextcloud.com>
1 parent 10a0218 commit 5d62764

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

lib/PhpStatistics.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,17 +99,20 @@ protected function getAPCuStatus(): array {
9999
}
100100

101101
/**
102-
* Get all loaded php extensions
102+
* Get all loaded php extensions (PHP + Zend), de-duplicated and sorted.
103103
*
104-
* @return array|null of strings with the names of the loaded extensions
104+
* @return array|null array of extension names, or null if PHP forbids enumeration
105105
*/
106106
protected function getLoadedPhpExtensions(): ?array {
107107
if (!function_exists('get_loaded_extensions')) {
108108
return null;
109109
}
110-
$extensions = get_loaded_extensions();
111-
natcasesort($extensions);
112-
113-
return $extensions;
110+
$extensions = get_loaded_extensions(false);
111+
// `get_loaded_extensions(true)` returns Zend extensions (OPcache, Xdebug, etc.)
112+
// which are otherwise hidden from the regular call.
113+
$zend = get_loaded_extensions(true);
114+
$all = array_values(array_unique(array_merge($extensions, $zend)));
115+
natcasesort($all);
116+
return array_values($all);
114117
}
115118
}

0 commit comments

Comments
 (0)