Legoktm has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/318351

Change subject: Don't fatal on invalid timestamps
......................................................................

Don't fatal on invalid timestamps

Database::timestamp() intentionally lets errors bubble up, so catch
invalid user-provided timestamps in
ReverseChronologicalPage::getDateCond(), and avoid using an offset in
that case.

Bug: T149257
Change-Id: Ida85eb44b66e8a0166e7f68a101ff094e04b1c8e
---
M includes/pager/ReverseChronologicalPager.php
1 file changed, 6 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/51/318351/1

diff --git a/includes/pager/ReverseChronologicalPager.php 
b/includes/pager/ReverseChronologicalPager.php
index 4895b4f..b6c2e23 100644
--- a/includes/pager/ReverseChronologicalPager.php
+++ b/includes/pager/ReverseChronologicalPager.php
@@ -150,7 +150,12 @@
                $timestamp = MWTimestamp::getInstance( "${ymd}000000" );
                $timestamp->setTimezone( $this->getConfig()->get( 
'Localtimezone' ) );
 
-               $this->mOffset = $this->mDb->timestamp( 
$timestamp->getTimestamp() );
+               try {
+                       $this->mOffset = $this->mDb->timestamp( 
$timestamp->getTimestamp() );
+               } catch ( TimestampException $e ) {
+                       // Invalid user provided timestamp (T149257)
+                       return;
+               }
                return $this->mOffset;
        }
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/318351
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ida85eb44b66e8a0166e7f68a101ff094e04b1c8e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to