X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FStorage%2FSqlBlobStore.php;h=fb3ef944994cd89a03fdf8d4fec1eb833b3dff25;hb=6cfdbdf60e69cce31d2f28f0a0e7e478785fe886;hp=72de2c961ab6b5c0b5bd12fe3059ec96c1acfda7;hpb=a223691b7c54ac8a4cf7bc5d896eb004244723d5;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Storage/SqlBlobStore.php b/includes/Storage/SqlBlobStore.php index 72de2c961a..fb3ef94499 100644 --- a/includes/Storage/SqlBlobStore.php +++ b/includes/Storage/SqlBlobStore.php @@ -349,7 +349,7 @@ class SqlBlobStore implements IDBAccessObject, BlobStore { $blob = $this->expandBlob( $row->old_text, $row->old_flags, $blobAddress ); if ( $blob === false ) { - wfWarn( __METHOD__ . ": Bad data in text row $textId." ); + wfLogWarning( __METHOD__ . ": Bad data in text row $textId." ); return false; } @@ -399,13 +399,13 @@ class SqlBlobStore implements IDBAccessObject, BlobStore { // No negative caching per BlobStore::getBlob() $blob = ExternalStore::fetchFromURL( $url, [ 'wiki' => $this->wikiId ] ); - return $this->decompressData( $blob, $flags ); + return $blob === false ? false : $this->decompressData( $blob, $flags ); }, [ 'pcGroup' => self::TEXT_CACHE_GROUP, 'pcTTL' => WANObjectCache::TTL_PROC_LONG ] ); } else { $blob = ExternalStore::fetchFromURL( $url, [ 'wiki' => $this->wikiId ] ); - return $this->decompressData( $blob, $flags ); + return $blob === false ? false : $this->decompressData( $blob, $flags ); } } else { return $this->decompressData( $raw, $flags ); @@ -461,7 +461,7 @@ class SqlBlobStore implements IDBAccessObject, BlobStore { * @note direct use is deprecated, use getBlob() or SlotRecord::getContent() instead. * @todo make this private, there should be no need to use this method outside this class. * - * @param mixed $blob Reference to a text + * @param string $blob Blob in compressed/encoded form. * @param array $blobFlags Compression flags, such as 'gzip'. * Note that not including 'utf-8' in $blobFlags will cause the data to be decoded * according to the legacy encoding specified via setLegacyEncoding. @@ -469,10 +469,8 @@ class SqlBlobStore implements IDBAccessObject, BlobStore { * @return string|bool Decompressed text, or false on failure */ public function decompressData( $blob, array $blobFlags ) { - if ( $blob === false ) { - // Text failed to be fetched; nothing to do - return false; - } + // Revision::decompressRevisionText accepted false here, so defend against that + Assert::parameterType( 'string', $blob, '$blob' ); if ( in_array( 'error', $blobFlags ) ) { // Error row, return false @@ -486,7 +484,7 @@ class SqlBlobStore implements IDBAccessObject, BlobStore { $blob = gzinflate( $blob ); if ( $blob === false ) { - wfLogWarning( __METHOD__ . ': gzinflate() failed' ); + wfWarn( __METHOD__ . ': gzinflate() failed' ); return false; } }