Skip to content

Commit 3ff3a24

Browse files
authored
Merge pull request #987 from nextcloud/backport/980/stable33
[stable33] fix(php): include Zend extensions in loaded extensions list
2 parents 3db3985 + f928d8f commit 3ff3a24

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

lib/PhpStatistics.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,23 @@ 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();
110+
111+
// `get_loaded_extensions(true)` returns Zend extensions (OPcache, Xdebug, etc.)
112+
// which are otherwise hidden from the regular call.
113+
$extensions = array_merge(
114+
get_loaded_extensions(false),
115+
get_loaded_extensions(true)
116+
);
117+
118+
$extensions = array_unique(array_map('strtolower', $extensions));
111119
natcasesort($extensions);
112120

113121
return $extensions;

0 commit comments

Comments
 (0)