jenkins-bot has submitted this change and it was merged.
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, 8 insertions(+), 2 deletions(-)
Approvals:
Aaron Schulz: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/pager/ReverseChronologicalPager.php
b/includes/pager/ReverseChronologicalPager.php
index 4895b4f..6f325c9 100644
--- a/includes/pager/ReverseChronologicalPager.php
+++ b/includes/pager/ReverseChronologicalPager.php
@@ -80,7 +80,7 @@
// If year and month are false, don't update the mOffset
if ( !$this->mYear && !$this->mMonth ) {
- return;
+ return null;
}
// Given an optional year, month, and day, we need to generate
a timestamp
@@ -150,7 +150,13 @@
$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 null;
+ }
+
return $this->mOffset;
}
}
--
To view, visit https://gerrit.wikimedia.org/r/318351
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ida85eb44b66e8a0166e7f68a101ff094e04b1c8e
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Paladox <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits