@@ -880,24 +880,19 @@ function write_information(): void
880
880
// load list of enabled and loadable extensions
881
881
save_text ($ info_file , <<<'PHP'
882
882
<?php
883
- $exts = [];
884
- foreach (get_loaded_extensions() as $ext) {
885
- $exts[] = ['Zend OPcache' => 'opcache'][$ext] ?? $ext;
886
- }
883
+ $exts = get_loaded_extensions();
887
884
$ext_dir = ini_get('extension_dir');
888
885
foreach (scandir($ext_dir) as $file) {
889
- if (!preg_match('/^(?:php_)?([_a-zA-Z0-9]+)\.(?:so|dll)$/', $file, $matches)) {
890
- continue;
891
- }
892
- $ext = $matches[1];
893
- if (!in_array($ext, $exts) && !extension_loaded($ext) && @dl($file)) {
894
- $exts[] = $ext;
886
+ if (preg_match('/^(?:php_)?([_a-zA-Z0-9]+)\.(?:so|dll)$/', $file, $matches)) {
887
+ if (@dl($matches[1])) {
888
+ $exts[] = $matches[1];
889
+ }
895
890
}
896
891
}
897
892
echo implode(',', $exts);
898
- ?>
899
- PHP );
900
- $ exts_to_test = explode ( ' , ' , shell_exec ( " $ php $ pass_options $ info_params $ no_file_cache \" $ info_file \"" ));
893
+ PHP);
894
+ $ extensionsNames = explode ( ' , ' , shell_exec ( " $ php $ pass_options $ info_params $ no_file_cache \" $ info_file \"" ) );
895
+ $ exts_to_test = array_unique ( remap_loaded_extensions_names ( $ extensionsNames ));
901
896
// check for extensions that need special handling and regenerate
902
897
$ info_params_ex = [
903
898
'session ' => ['session.auto_start=0 ' ],
@@ -2784,6 +2779,22 @@ function run_test(string $php, $file, array $env): string
2784
2779
return $ restype [0 ] . 'ED ' ;
2785
2780
}
2786
2781
2782
+ /**
2783
+ * Map "Zend OPcache" to "opcache" and convert all ext names to lowercase.
2784
+ */
2785
+ function remap_loaded_extensions_names (array $ names ): array
2786
+ {
2787
+ $ exts = [];
2788
+ foreach ($ names as $ name ) {
2789
+ if ($ name === 'Core ' ) {
2790
+ continue ;
2791
+ }
2792
+ $ exts [] = ['Zend OPcache ' => 'opcache ' ][$ name ] ?? strtolower ($ name );
2793
+ }
2794
+
2795
+ return $ exts ;
2796
+ }
2797
+
2787
2798
/**
2788
2799
* @return bool|int
2789
2800
*/
@@ -3674,11 +3685,8 @@ public function getExtensions(string $php): array
3674
3685
}
3675
3686
3676
3687
$ extDir = shell_exec ("$ php -d display_errors=0 -r \"echo ini_get('extension_dir'); \"" );
3677
- $ extensions = explode (", " , shell_exec ("$ php -d display_errors=0 -r \"echo implode(',', get_loaded_extensions()); \"" ));
3678
- $ extensions = array_map ('strtolower ' , $ extensions );
3679
- if (in_array ('zend opcache ' , $ extensions )) {
3680
- $ extensions [] = 'opcache ' ;
3681
- }
3688
+ $ extensionsNames = explode (", " , shell_exec ("$ php -d display_errors=0 -r \"echo implode(',', get_loaded_extensions()); \"" ));
3689
+ $ extensions = remap_loaded_extensions_names ($ extensionsNames );
3682
3690
3683
3691
$ result = [$ extDir , $ extensions ];
3684
3692
$ this ->extensions [$ php ] = $ result ;
0 commit comments