From 2f6056fab682141c9d81824d54cb053627a80d89 Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Thu, 6 Feb 2014 18:38:25 -0800 Subject: [PATCH] GitInfo: Suppress some wrong warnings It's possible to have a ')' in a .git/config file, but parse_ini_file will claim that's invalid and display a warning. Also prevent another warning from occurring if the parse_ini_file failed and $configArray is null. Change-Id: Iba54220be266cb885e83cddfa6c8e9782aa77d01 --- includes/GitInfo.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/includes/GitInfo.php b/includes/GitInfo.php index 1f465c7551..877c2d24e5 100644 --- a/includes/GitInfo.php +++ b/includes/GitInfo.php @@ -169,13 +169,15 @@ class GitInfo { return false; } + wfSuppressWarnings(); $configArray = parse_ini_file( $config, true ); + wfRestoreWarnings(); $remote = false; // Use the "origin" remote repo if available or any other repo if not. if ( isset( $configArray['remote origin'] ) ) { $remote = $configArray['remote origin']; - } else { + } elseif ( is_array( $configArray ) ) { foreach ( $configArray as $sectionName => $sectionConf ) { if ( substr( $sectionName, 0, 6 ) == 'remote' ) { $remote = $sectionConf; -- 2.20.1