X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fpage%2FImageHistoryPseudoPager.php;h=799c33ad902b407d07da445100cee3c376c362e8;hb=485547cd805a5b06a6c79cc6c9f18dbe5793e026;hp=20bc614b51d19f16d9fe7a60f8a636d9001d56fb;hpb=7320a9577e882fbeacb1772977fbfecf8aa5424d;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/page/ImageHistoryPseudoPager.php b/includes/page/ImageHistoryPseudoPager.php index 20bc614b51..799c33ad90 100644 --- a/includes/page/ImageHistoryPseudoPager.php +++ b/includes/page/ImageHistoryPseudoPager.php @@ -18,6 +18,8 @@ * @file */ +use Wikimedia\Timestamp\TimestampException; + class ImageHistoryPseudoPager extends ReverseChronologicalPager { protected $preventClickjacking = false; @@ -138,6 +140,14 @@ class ImageHistoryPseudoPager extends ReverseChronologicalPager { if ( !$this->mImg->exists() ) { return; } + // Make sure the date (probably from user input) is valid; if not, drop it. + if ( $this->mOffset !== null ) { + try { + $sadlyWeCannotPassThisTimestampDownTheStack = $this->mDb->timestamp( $this->mOffset ); + } catch ( TimestampException $e ) { + $this->mOffset = null; + } + } $queryLimit = $this->mLimit + 1; // limit plus extra row if ( $this->mIsBackwards ) { // Fetch the file history