Last modified: 2009-04-15 22:41:11 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 18376 - DateFormatter::reformat called unnecessarily
DateFormatter::reformat called unnecessarily
Status: RESOLVED INVALID
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
1.15.x
All All
: Normal minor with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-04-06 23:22 UTC by wclark
Modified: 2009-04-15 22:41 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description wclark 2009-04-06 23:22:35 UTC
In Parser::internalParse, a call is made to DateFormatter::reformat even when the user's preference is set to 'default' which means that date formats should remain unchanged.  This can be confirmed by noticing that (although the date format remains unchanged) a comma is inserted into linked dates that are in MDY format.

For example, the following wikitext:

[[March 30]] [[2007]]

Will be rendered in the page as:

[[March 30]], [[2007]]

While it's true that the comma is supposed to be there anyway, there's no reason to use the reformat method to add it (it should just be added to the wikitext directly.. and the actions of DateFormatter::reformat actually hide this minor typo from casual readers, making it harder to notice and fix.)

In line 889 of Parser.php, this line:

 if( $this->mOptions->getUseDynamicDates() ) {

Should be changed to this:

 if( $this->mOptions->getUseDynamicDates() and $this-mOptions->getDateFormat() != 'default') {

That will prevent DateFormatter::reformat from being called unnecessarily and both wasting CPU cycles (by checking against all the various date format regexes when no actual date transformations will be applied) and hiding a minor grammatical error that should be fixed directly.
Comment 1 wclark 2009-04-06 23:31:08 UTC
Well actually it should be changed to this:

 if( $this->mOptions->getUseDynamicDates() and $this->mOptions->getDateFormat() != 'default' ) {

..but who wants syntactically correct code?
Comment 2 wclark 2009-04-15 22:41:11 UTC
This bug is now irrelevant because DynamicDates is going to be disabled (on en-wiki at least) and there are problems (listed elsewhere) with the approach, anyway.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links