@@ -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 ' ],
@@ -2789,6 +2784,22 @@ function run_test(string $php, $file, array $env): string
2789
2784
return $ restype [0 ] . 'ED ' ;
2790
2785
}
2791
2786
2787
+ /**
2788
+ * Map "Zend OPcache" to "opcache" and convert all ext names to lowercase.
2789
+ */
2790
+ function remap_loaded_extensions_names (array $ names ): array
2791
+ {
2792
+ $ exts = [];
2793
+ foreach ($ names as $ name ) {
2794
+ if ($ name === 'Core ' ) {
2795
+ continue ;
2796
+ }
2797
+ $ exts [] = ['Zend OPcache ' => 'opcache ' ][$ name ] ?? strtolower ($ name );
2798
+ }
2799
+
2800
+ return $ exts ;
2801
+ }
2802
+
2792
2803
/**
2793
2804
* @return bool|int
2794
2805
*/
@@ -3686,11 +3697,8 @@ public function getExtensions(string $php): array
3686
3697
}
3687
3698
3688
3699
$ extDir = shell_exec ("$ php -d display_errors=0 -r \"echo ini_get('extension_dir'); \"" );
3689
- $ extensions = explode (", " , shell_exec ("$ php -d display_errors=0 -r \"echo implode(',', get_loaded_extensions()); \"" ));
3690
- $ extensions = array_map ('strtolower ' , $ extensions );
3691
- if (in_array ('zend opcache ' , $ extensions )) {
3692
- $ extensions [] = 'opcache ' ;
3693
- }
3700
+ $ extensionsNames = explode (", " , shell_exec ("$ php -d display_errors=0 -r \"echo implode(',', get_loaded_extensions()); \"" ));
3701
+ $ extensions = remap_loaded_extensions_names ($ extensionsNames );
3694
3702
3695
3703
$ result = [$ extDir , $ extensions ];
3696
3704
$ this ->extensions [$ php ] = $ result ;
0 commit comments