Last modified: 2012-04-14 19:39:34 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T30350, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 28350 - Value of $wgDocType has no effect in default 1.16.2 install
Value of $wgDocType has no effect in default 1.16.2 install
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
1.16.x
All All
: Normal minor (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-03-31 16:36 UTC by steevithak
Modified: 2012-04-14 19:39 UTC (History)
2 users (show)

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


Attachments

Description steevithak 2011-03-31 16:36:17 UTC
The MediaWiki documentation suggests that $wgDocType defaults to XHTML Transitional and that changing the value of this variable with alter the doctype that appears in the live pages. Neither of these things is correct in the default install.

In actuality, there is another config value, $wgHtml5, which defaults to True and overrides the value $wgDocType. The actual doctype value will always be XHTML Strict regardless of what is set in $wgDocType unless you first set $wgHtml5 to false.

I'm not certain what the intended behavior is here. Since I'd like to have the XHTML Transitional doctype, which is described by the documentation as the default, this seems like a bug in MediaWiki to me. But if the intended behavior is to support only XHTML strict, then the bug is possibly in the documentation, which should say that $wgDocType is deprecated.
Comment 1 Mark A. Hershberger 2011-03-31 18:58:12 UTC
Are you referring to the documentation at http://www.mediawiki.org/wiki/Manual:$wgDocType or somewhere else?
Comment 2 steevithak 2011-03-31 20:30:28 UTC
Yes, also in the DefaultSettings.php, $wgDocType is set to XHTML transitional, which suggests to a new MediaWiki user that you'll see that doctype in the web pages. A comment by that setting saying it doesn't do anything if $wgHtml5 is set might be helpful.
Comment 3 Aryeh Gregor (not reading bugmail, please e-mail directly) 2011-03-31 22:51:17 UTC
This is not a bug in the software.  The semantics of $wgDocType don't make sense for HTML5, because it's used to output a doctype like

  <!DOCTYPE html PUBLIC "$wgDocType" "$wgDTD">

while the HTML5 doctype is just

  <!DOCTYPE html>

so there's nothing you could set $wgDocType or $wgDTD to to get the default doctype we want.  So by default I just ignored it in $wgHtml5.

If doctype overriding is actually useful, we could add a new configuration option like $wgDocTypeOverride that sets the whole doctype as one string, so by default it could be "<!DOCTYPE html>" but wiki operators could customize it to whatever they felt like.  This might be useful for Wikimedia deployment of $wgHtml5 = true, as I remarked recently on wikitech-l.

Note that in 1.17 and later, the default doctype is "<!DOCTYPE html>".  The default doctype in 1.16 is different for tiresome reasons that I won't bother explaining, but that's irrelevant for bug-tracking purposes, since branches are mostly only maintained for security and so we aren't going to be changing around how 1.16 works.

Why do you want an XHTML Transitional doctype?
Comment 4 Brion Vibber 2011-03-31 23:09:39 UTC
The doc comment on $wgDocType and $wgDTD don't mention that they have no effect if $wgHtml5 is set, so this is definitely a documentation bug:

  /** The HTML document type. */
  $wgDocType = '-//W3C//DTD XHTML 1.0 Transitional//EN';
  
  /** The URL of the document type declaration. */
  $wgDTD = 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd';
  
  /** The default xmlns attribute. */
  $wgXhtmlDefaultNamespace = 'http://www.w3.org/1999/xhtml';
  
  /**
   * Should we output an HTML5 doctype?  If false, use XHTML 1.0 Transitional
   * instead, and disable HTML5 features.  This may eventually be removed and set
   * to always true.
   */
  $wgHtml5 = true;

If $wgHtml5 being on disables the three other settings, then they should all be updated to indicate this.
Comment 5 steevithak 2011-03-31 23:20:47 UTC
As I said, the bug may be in the *documentation* rather than the code. If
$wgDocType id deprecated or conflicts with $wgHtml5, then the docs need
updating.

My experience was that once I set $wgHtml5 to false, the behavior of the
software matched the explanation in the docs (e.g. changing $wgDocType changed
the doctype value in the generated page). 

I wanted to set the doctype to XHTML transitional because I'm working on
getting the mediawiki generated pages to validate. With the strict doctype I
get a lot of errors when validating through the W3C checker. Many of those
issues are not errors under XHTML transitional.
Comment 6 Brion Vibber 2011-04-01 00:04:31 UTC
$wgXhtmlNamespaces appears to also be disabled when $wgHtml5 is enabled.
Comment 7 Aryeh Gregor (not reading bugmail, please e-mail directly) 2011-04-01 14:50:55 UTC
Documentation updated in r85124.  If there's anything I missed, reopen, or file a new bug and CC me.

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


Navigation
Links