From 5d8690550da837efb082103fa869af4ace2ab461 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Niklas=20Laxstr=C3=B6m?= Date: Wed, 1 Sep 2010 08:25:55 +0000 Subject: [PATCH] file_exists can emit warnings under safe mode... silence those for diff and diff3 --- includes/GlobalFunctions.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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(); -- 2.20.1