file_exists can emit warnings under safe mode... silence those for diff and diff3
authorNiklas Laxström <nikerabbit@users.mediawiki.org>
Wed, 1 Sep 2010 08:25:55 +0000 (08:25 +0000)
committerNiklas Laxström <nikerabbit@users.mediawiki.org>
Wed, 1 Sep 2010 08:25:55 +0000 (08:25 +0000)
includes/GlobalFunctions.php

index 918bc44..b89ab2f 100644 (file)
@@ -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();