From: Tim Starling Date: Wed, 7 Jan 2009 12:20:30 +0000 (+0000) Subject: Test for disable_functions as well as safe_mode before attempting passthru(). For... X-Git-Tag: 1.31.0-rc.0~43521 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/pie.php?a=commitdiff_plain;h=b426115265fd2ddcd58ca8a2fb1fd2c5abc0bc2f;p=lhc%2Fweb%2Fwiklou.git Test for disable_functions as well as safe_mode before attempting passthru(). For fix of bug 16902 in new-installer branch. --- diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 2b23802bba..b4303a0b26 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -2101,11 +2101,26 @@ function wfIniGetBool( $setting ) { function wfShellExec( $cmd, &$retval=null ) { global $IP, $wgMaxShellMemory, $wgMaxShellFileSize, $wgMaxShellTime; - if( wfIniGetBool( 'safe_mode' ) ) { - wfDebug( "wfShellExec can't run in safe_mode, PHP's exec functions are too broken.\n" ); + static $disabled; + 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 = true; + } + $functions = explode( ',', ini_get( 'disable_functions' ) ); + $functions = array_map( 'trim', $functions ); + $functions = array_map( 'strtolower', $functions ); + if ( in_array( 'passthru', $functions ) ) { + wfDebug( "passthru is in disabled_functions\n" ); + $disabled = true; + } + } + if ( $disabled ) { $retval = 1; return "Unable to run external programs in safe mode."; } + wfInitShellLocale(); if ( php_uname( 's' ) == 'Linux' ) {