jenkins-bot has submitted this change and it was merged.
Change subject: Fix timestamp validation
......................................................................
Fix timestamp validation
Bug: 61058
Change-Id: Icc19da3626a090bed04eb9773c748e90223ab3f4
---
M SpecialFeedItem.php
1 file changed, 14 insertions(+), 6 deletions(-)
Approvals:
Ori.livneh: Looks good to me, approved
jenkins-bot: Verified
diff --git a/SpecialFeedItem.php b/SpecialFeedItem.php
index de2d3a1..fff6a0b 100644
--- a/SpecialFeedItem.php
+++ b/SpecialFeedItem.php
@@ -21,12 +21,8 @@
return;
}
$feed = $feeds[$feedName];
- $ts = new MWTimestamp( $date );
- $timestamp = $ts->getTimestamp();
- if ( !$timestamp
- || strlen( $timestamp ) !== 14 ) // @fixme: hack until
Language::sprintfDate() learns to handle
- // timestamps >= Y10k
- {
+ $timestamp = $this->parseTimestamp( $date );
+ if ( !$timestamp ) {
$out->showErrorPage( 'error', 'ffeed-invalid-timestamp'
);
return;
}
@@ -57,6 +53,18 @@
}
}
+ private function parseTimestamp( $date ) {
+ if ( strlen( $date ) !== 14 ) {
+ return false;
+ }
+ try {
+ $ts = new MWTimestamp( $date );
+ } catch( MWException $ex ) {
+ return false;
+ };
+ return $ts->getTimestamp();
+ }
+
private function displayItem( FeaturedFeedItem $item ) {
$out = $this->getOutput();
$out->setPageTitle( $item->getRawTitle() );
--
To view, visit https://gerrit.wikimedia.org/r/112139
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Icc19da3626a090bed04eb9773c748e90223ab3f4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/FeaturedFeeds
Gerrit-Branch: master
Gerrit-Owner: MaxSem <[email protected]>
Gerrit-Reviewer: Awjrichards <[email protected]>
Gerrit-Reviewer: Kaldari <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits