From: Kevin Israel Date: Mon, 31 Mar 2014 14:19:57 +0000 (-0400) Subject: Don't parse disable_functions INI value X-Git-Tag: 1.31.0-rc.0~15250 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=commitdiff_plain;h=74e6ce4fd65c89ba83ce5244f7085fac19d4a735;p=lhc%2Fweb%2Fwiklou.git Don't parse disable_functions INI value In wfDebugBacktrace() and wfShellExecDisabled(), use function_exists() instead of getting the value of the disable_functions INI setting, then splitting it into a list of functions, then checking that list for the function to be called. Also removed the check for Zend Optimizer, an old PHP extension that does not work with PHP 5.3. Change-Id: I04f0e026f8a6e0414f08d5302aff6c084a1d19a7 --- diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index ce5f8a3dea..d4f2594989 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -1891,13 +1891,8 @@ function wfReportTime() { /** * Safety wrapper for debug_backtrace(). * - * With Zend Optimizer 3.2.0 loaded, this causes segfaults under somewhat - * murky circumstances, which may be triggered in part by stub objects - * or other fancy talking'. - * - * Will return an empty array if Zend Optimizer is detected or if - * debug_backtrace is disabled, otherwise the output from - * debug_backtrace() (trimmed). + * Will return an empty array if debug_backtrace is disabled, otherwise + * the output from debug_backtrace() (trimmed). * * @param int $limit This parameter can be used to limit the number of stack frames returned * @@ -1906,19 +1901,10 @@ function wfReportTime() { function wfDebugBacktrace( $limit = 0 ) { static $disabled = null; - if ( extension_loaded( 'Zend Optimizer' ) ) { - wfDebug( "Zend Optimizer detected; skipping debug_backtrace for safety.\n" ); - return array(); - } - if ( is_null( $disabled ) ) { - $disabled = false; - $functions = explode( ',', ini_get( 'disable_functions' ) ); - $functions = array_map( 'trim', $functions ); - $functions = array_map( 'strtolower', $functions ); - if ( in_array( 'debug_backtrace', $functions ) ) { - wfDebug( "debug_backtrace is in disabled_functions\n" ); - $disabled = true; + $disabled = !function_exists( 'debug_backtrace' ); + if ( $disabled ) { + wfDebug( "debug_backtrace() is disabled\n" ); } } if ( $disabled ) { @@ -2818,18 +2804,14 @@ function wfEscapeShellArg( /*...*/ ) { function wfShellExecDisabled() { static $disabled = null; if ( is_null( $disabled ) ) { - $disabled = false; if ( wfIniGetBool( 'safe_mode' ) ) { wfDebug( "wfShellExec can't run in safe_mode, PHP's exec functions are too broken.\n" ); $disabled = 'safemode'; + } elseif ( !function_exists( 'proc_open' ) ) { + wfDebug( "proc_open() is disabled\n" ); + $disabled = 'disabled'; } else { - $functions = explode( ',', ini_get( 'disable_functions' ) ); - $functions = array_map( 'trim', $functions ); - $functions = array_map( 'strtolower', $functions ); - if ( in_array( 'proc_open', $functions ) ) { - wfDebug( "proc_open is in disabled_functions\n" ); - $disabled = 'disabled'; - } + $disabled = false; } } return $disabled;