From: Aaron Schulz Date: Tue, 20 Dec 2011 21:58:29 +0000 (+0000) Subject: FU r106514: Sanity check for empty sha1 values in the DB X-Git-Tag: 1.31.0-rc.0~25848 X-Git-Url: http://git.cyclocoop.org/%24action?a=commitdiff_plain;h=572d49addc2fb1e4935776d3559eb90f5d074bcf;p=lhc%2Fweb%2Fwiklou.git FU r106514: Sanity check for empty sha1 values in the DB --- diff --git a/includes/api/ApiQueryDeletedrevs.php b/includes/api/ApiQueryDeletedrevs.php index 0422eba33e..3be0a7ac64 100644 --- a/includes/api/ApiQueryDeletedrevs.php +++ b/includes/api/ApiQueryDeletedrevs.php @@ -236,7 +236,11 @@ class ApiQueryDeletedrevs extends ApiQueryBase { $rev['len'] = $row->ar_len; } if ( $fld_sha1 ) { - $rev['sha1'] = wfBaseConvert( $row->ar_sha1, 36, 16, 40 ); + if ( $row->ar_sha1 != '' ) { + $rev['sha1'] = wfBaseConvert( $row->ar_sha1, 36, 16, 40 ); + } else { + $rev['sha1'] = ''; + } } if ( $fld_content ) { ApiResult::setContent( $rev, Revision::getRevisionText( $row ) ); diff --git a/includes/api/ApiQueryRevisions.php b/includes/api/ApiQueryRevisions.php index 8da079c03d..f8003a3b32 100644 --- a/includes/api/ApiQueryRevisions.php +++ b/includes/api/ApiQueryRevisions.php @@ -414,7 +414,11 @@ class ApiQueryRevisions extends ApiQueryBase { } if ( $this->fld_sha1 ) { - $vals['sha1'] = wfBaseConvert( $revision->getSha1(), 36, 16, 40 ); + if ( $revision->getSha1() != '' ) { + $vals['sha1'] = wfBaseConvert( $revision->getSha1(), 36, 16, 40 ); + } else { + $vals['sha1'] = ''; + } } if ( $this->fld_comment || $this->fld_parsedcomment ) {