mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-17 20:15:08 +00:00
General: Correct the fallback logic in apache_mod_loaded()
.
If the `apache_get_modules()` function is redeclared to return an empty array, `apache_mod_loaded()` would assume that no Apache modules are installed and activated, which may not be correct. This commit improves the logic by using pre-existing `phpinfo()` fallback to check for loaded modules in that case. Includes replacing a hardcoded number passed as a flag to `phpinfo()` with the `INFO_MODULES` predefined constant for clarity. Follow-up to [7441], [7508], [29330]. Props engahmeds3ed, audrasjb, Clorith, SergeyBiryukov. Fixes #56010. Built from https://develop.svn.wordpress.org/trunk@54299 git-svn-id: http://core.svn.wordpress.org/trunk@53858 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
99d0310f77
commit
3d245c574e
@ -5888,15 +5888,24 @@ function apache_mod_loaded( $mod, $default = false ) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$loaded_mods = array();
|
||||||
|
|
||||||
if ( function_exists( 'apache_get_modules' ) ) {
|
if ( function_exists( 'apache_get_modules' ) ) {
|
||||||
$mods = apache_get_modules();
|
$loaded_mods = apache_get_modules();
|
||||||
if ( in_array( $mod, $mods, true ) ) {
|
|
||||||
|
if ( in_array( $mod, $loaded_mods, true ) ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} elseif ( function_exists( 'phpinfo' ) && false === strpos( ini_get( 'disable_functions' ), 'phpinfo' ) ) {
|
}
|
||||||
ob_start();
|
|
||||||
phpinfo( 8 );
|
if ( empty( $loaded_mods )
|
||||||
$phpinfo = ob_get_clean();
|
&& function_exists( 'phpinfo' )
|
||||||
|
&& false === strpos( ini_get( 'disable_functions' ), 'phpinfo' )
|
||||||
|
) {
|
||||||
|
ob_start();
|
||||||
|
phpinfo( INFO_MODULES );
|
||||||
|
$phpinfo = ob_get_clean();
|
||||||
|
|
||||||
if ( false !== strpos( $phpinfo, $mod ) ) {
|
if ( false !== strpos( $phpinfo, $mod ) ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.1-beta1-54298';
|
$wp_version = '6.1-beta1-54299';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user