From 9d70a4495d20f4c89a8c394a487201d44d3d5219 Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Mon, 29 Aug 2016 02:58:25 +0000 Subject: [PATCH] Bootstrap: Check that `ini_get_all()` exists before calling it, allows us to work around hosts who disable the function for "security purposes". Fixes #37680 for trunk. git-svn-id: https://develop.svn.wordpress.org/trunk@38431 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/load.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/load.php b/src/wp-includes/load.php index 98c6d42a94..14f58bc104 100644 --- a/src/wp-includes/load.php +++ b/src/wp-includes/load.php @@ -1017,14 +1017,23 @@ function wp_is_ini_value_changeable( $setting ) { static $ini_all; if ( ! isset( $ini_all ) ) { - $ini_all = ini_get_all(); - } + $ini_all = false; + // Sometimes `ini_get_all()` is disabled via the `disable_functions` option for "security purposes". + if ( function_exists( 'ini_get_all' ) ) { + $ini_all = ini_get_all(); + } + } // Bit operator to workaround https://bugs.php.net/bug.php?id=44936 which changes access level to 63 in PHP 5.2.6 - 5.2.17. if ( isset( $ini_all[ $setting ]['access'] ) && ( INI_ALL === ( $ini_all[ $setting ]['access'] & 7 ) || INI_USER === ( $ini_all[ $setting ]['access'] & 7 ) ) ) { return true; } + // If we were unable to retrieve the details, fail gracefully to assume it's changeable. + if ( ! is_array( $ini_all ) ) { + return true; + } + return false; }