From: Tim Starling Date: Thu, 19 Jan 2006 03:59:20 +0000 (+0000) Subject: Don't try to inflate or unserialize an error flag X-Git-Tag: 1.6.0~482 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=31262fdf293b09dfb040738f903683ed048ac533;p=lhc%2Fweb%2Fwiklou.git Don't try to inflate or unserialize an error flag --- diff --git a/includes/Revision.php b/includes/Revision.php index 437d1d85d6..c390df0636 100644 --- a/includes/Revision.php +++ b/includes/Revision.php @@ -449,31 +449,28 @@ class Revision { $text=ExternalStore::fetchFromURL($url); } - if( in_array( 'gzip', $flags ) ) { - # Deal with optional compression of archived pages. - # This can be done periodically via maintenance/compressOld.php, and - # as pages are saved if $wgCompressRevisions is set. - $text = gzinflate( $text ); - } - - if( in_array( 'object', $flags ) ) { - # Generic compressed storage - $obj = unserialize( $text ); - - # Bugger, corrupted my test database by double-serializing - if ( !is_object( $obj ) ) { - $obj = unserialize( $obj ); + // If the text was fetched without an error, convert it + if ( $text !== false ) { + if( in_array( 'gzip', $flags ) ) { + # Deal with optional compression of archived pages. + # This can be done periodically via maintenance/compressOld.php, and + # as pages are saved if $wgCompressRevisions is set. + $text = gzinflate( $text ); } - $text = $obj->getText(); - } + if( in_array( 'object', $flags ) ) { + # Generic compressed storage + $obj = unserialize( $text ); + $text = $obj->getText(); + } - global $wgLegacyEncoding; - if( $wgLegacyEncoding && !in_array( 'utf-8', $flags ) ) { - # Old revisions kept around in a legacy encoding? - # Upconvert on demand. - global $wgInputEncoding, $wgContLang; - $text = $wgContLang->iconv( $wgLegacyEncoding, $wgInputEncoding . '//IGNORE', $text ); + global $wgLegacyEncoding; + if( $wgLegacyEncoding && !in_array( 'utf-8', $flags ) ) { + # Old revisions kept around in a legacy encoding? + # Upconvert on demand. + global $wgInputEncoding, $wgContLang; + $text = $wgContLang->iconv( $wgLegacyEncoding, $wgInputEncoding . '//IGNORE', $text ); + } } wfProfileOut( $fname ); return $text;