From: Niklas Laxström Date: Wed, 1 Sep 2010 08:25:55 +0000 (+0000) Subject: file_exists can emit warnings under safe mode... silence those for diff and diff3 X-Git-Tag: 1.31.0-rc.0~35252 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/cotisations/rappels.php?a=commitdiff_plain;h=5d8690550da837efb082103fa869af4ace2ab461;p=lhc%2Fweb%2Fwiklou.git file_exists can emit warnings under safe mode... silence those for diff and diff3 --- diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 918bc44a4d..b89ab2ffa1 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -1510,7 +1510,11 @@ function wfMerge( $old, $mine, $yours, &$result ) { # This check may also protect against code injection in # case of broken installations. - if( !$wgDiff3 || !file_exists( $wgDiff3 ) ) { + wfSuppressWarnings(); + $haveDiff3 = $wgDiff3 && file_exists( $wgDiff3 ); + wfRestoreWarnings(); + + if( !$haveDiff3 ) { wfDebug( "diff3 not found\n" ); return false; } @@ -1580,10 +1584,13 @@ function wfDiff( $before, $after, $params = '-u' ) { } global $wgDiff; + wfSuppressWarnings(); + $haveDiff = $wgDiff && file_exists( $wgDiff ); + wfRestoreWarnings(); # This check may also protect against code injection in # case of broken installations. - if( !file_exists( $wgDiff ) ) { + if( !$haveDiff ) { wfDebug( "diff executable not found\n" ); $diffs = new Diff( explode( "\n", $before ), explode( "\n", $after ) ); $format = new UnifiedDiffFormatter();