Thiemo Mättig (WMDE) has uploaded a new change for review.
https://gerrit.wikimedia.org/r/250440
Change subject: Fix insufficient preg_quote in MwTimeIsoParser
......................................................................
Fix insufficient preg_quote in MwTimeIsoParser
Change-Id: I4f50912b5c8d57b6e5ed3d70c5b09c7d9b2b75d5
---
M repo/includes/Parsers/MwTimeIsoParser.php
1 file changed, 19 insertions(+), 8 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase
refs/changes/40/250440/1
diff --git a/repo/includes/Parsers/MwTimeIsoParser.php
b/repo/includes/Parsers/MwTimeIsoParser.php
index 42180ab..abbbb6f 100644
--- a/repo/includes/Parsers/MwTimeIsoParser.php
+++ b/repo/includes/Parsers/MwTimeIsoParser.php
@@ -119,32 +119,43 @@
foreach ( self::$precisionMsgKeys as $precision =>
$msgKeysGroup ) {
foreach ( $msgKeysGroup as $msgKey ) {
$msg = new Message( $msgKey );
- //FIXME: Use the language passed in options!
- //The only reason we are not currently doing
this is due to the formatting not currently Localizing
- //See the fix me in:
MwTimeIsoFormatter::getMessage
+ // FIXME: Use the language passed in options!
The only reason we are not currently
+ // doing this is due to the formatting not
currently localizing. See the fix me in
+ // MwTimeIsoFormatter::getMessage.
// TODO: Check other translations?
- //$msg->inLanguage( $this->lang );
$msg->inLanguage( 'en' );
$msgText = $msg->text();
$isBceMsg = $this->isBceMsg( $msgKey );
list( $start, $end ) = explode( '$1', $msgText,
2 );
- if ( preg_match( '/^\s*' . preg_quote( $start )
. '(.+?)' . preg_quote( $end ) . '\s*$/i', $value, $matches ) ) {
+ if ( preg_match(
+ '/^\s*'
+ . preg_quote( $start, '/' ) .
'(.+?)'
+ . preg_quote( $end, '/' ) .
'\s*$/i',
+ $value,
+ $matches
+ ) ) {
list( , $number ) = $matches;
return $this->parseNumber( $number,
$precision, $isBceMsg );
}
// If the msg string ends with BCE also check
for BC
- if ( substr_compare( $end, 'BCE', - 3, 3 ) ===
0 ) {
- if ( preg_match( '/^\s*' . preg_quote(
$start ) . '(.+?)' . preg_quote( substr( $end, 0, -1 ) ) . '\s*$/i', $value,
$matches ) ) {
+ if ( substr_compare( $end, 'BCE', -3 ) === 0 ) {
+ if ( preg_match(
+ '/^\s*'
+ . preg_quote( $start,
'/' ) . '(.+?)'
+ . preg_quote( substr(
$end, 0, -1 ), '/' ) . '\s*$/i',
+ $value,
+ $matches
+ ) ) {
list( , $number ) = $matches;
return $this->parseNumber(
$number, $precision, $isBceMsg );
}
}
}
-
}
+
return false;
}
--
To view, visit https://gerrit.wikimedia.org/r/250440
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4f50912b5c8d57b6e5ed3d70c5b09c7d9b2b75d5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits