From: Brad Jorsch Date: Mon, 5 May 2014 14:23:30 +0000 (-0400) Subject: API: Check return value from $gitInfo->getHeadCommitDate() X-Git-Tag: 1.31.0-rc.0~15888^2 X-Git-Url: http://git.cyclocoop.org/ecrire?a=commitdiff_plain;h=986d3ef2c13aeaf8d172e89c30c2c2f93d9f1b55;p=lhc%2Fweb%2Fwiklou.git API: Check return value from $gitInfo->getHeadCommitDate() action=query&meta=siteinfo&siprop=extensions calls $gitInfo->getHeadCommitDate() to attempt to find the commit date, but does not check whether that function returned false before using the value. This resulted in displaying the current date for "vcs-date" when the function failed. Bug: 64821 Change-Id: Ic39a74abe5160b3b7fbfb7c15323328d6b317560 --- diff --git a/includes/api/ApiQuerySiteinfo.php b/includes/api/ApiQuerySiteinfo.php index b7796eee73..b0e9bd227e 100644 --- a/includes/api/ApiQuerySiteinfo.php +++ b/includes/api/ApiQuerySiteinfo.php @@ -567,7 +567,10 @@ class ApiQuerySiteinfo extends ApiQueryBase { $ret['vcs-system'] = 'git'; $ret['vcs-version'] = $vcsVersion; $ret['vcs-url'] = $gitInfo->getHeadViewUrl(); - $ret['vcs-date'] = wfTimestamp( TS_ISO_8601, $gitInfo->getHeadCommitDate() ); + $vcsDate = $gitInfo->getHeadCommitDate(); + if ( $vcsDate !== false ) { + $ret['vcs-date'] = wfTimestamp( TS_ISO_8601, $vcsDate ); + } } else { $svnInfo = SpecialVersion::getSvnInfo( $extensionPath ); if ( $svnInfo !== false ) {