Make WordPress Core

Opened 3 years ago

Last modified 15 months ago

#25863 new defect (bug)

Core not working when served as application/xhtml+xml

Reported by: pnutus Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 3.3
Component: General Keywords: has-patch
Focuses: template Cc:


All pages in Core has the following first lines:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>

The Doctype implies HTML5, but the xmlns attribute implies XHTML. The server I'm deploying on is interpreting the file as XHTML and serving it as application/xhtml+xml. Some Core pages contain named entities such as &nbsp;, which do not work when the page is served as application/xhtml+xml (at least not in WebKit/Blink browsers).

What is the point of the xmlns attribute, as it is deprecated in HTML5? Should we remove it?

Or change the named entities to numeric? related: #13341 #9030

Attachments (2)

ticket-25863-xmlns-removal.patch (7.7 KB) - added by bpetty 3 years ago.
28563.diff (8.1 KB) - added by MikeHansenMe 20 months ago.
remove tinymce file from the changes.

Download all attachments as: .zip

Change History (14)

#1 @bpetty
3 years ago

Related (for bundled themes): #14226
Also see: #18202 (HTML5 doctype for core)

It's not deprecated, but it is supposed to be irrelevant to HTML documents (as far as I understand it). However, I could see how some servers might interpret this as xhtml+xml since this is how you're supposed to define polyglot markup now, which is implied to be XHTML.

Note that #14226 points out that this could affect use of MathML and SVG. But I generally still agree with @nacin that as a CMS, WordPress shouldn't even be trying to support XHTML.

I'm fairly certain we should remove it (and will have a patch for it in a bit), but it should also be possible to prevent your server configuration from assuming it's XHTML, and serving it as application/xhtml+xml (WordPress is not responsible for this). What is your server running?

#2 @bpetty
3 years ago

  • Cc bpetty added
  • Keywords has-patch added

#3 @SergeyBiryukov
3 years ago

  • Keywords has-patch removed
  • Version changed from 3.7.1 to 3.3

We moved to <!DOCTYPE html> in #18202, so 3.3 is the earliest applicable version here.

Some previous discussions on application/xhtml+xml: #14224, #14225, #14226, #14363, #17453.

#4 @SergeyBiryukov
3 years ago

  • Keywords has-patch added

#5 @pnutus
3 years ago

My server is some kind of custom solution, and the administrator is reluctant to change the server configuration. So right now I have no choice but to remove xmlns manually.

I just thought I might contribute, and that it hopefully could be fixed upstream :)

Last edited 3 years ago by pnutus (previous) (diff)

#6 @pnutus
3 years ago

Do you know if I could put anything in my .htaccess file to make apache serve all php files as text/html as an interim solution? I have tried AddType text/html .php, but then it just stops evaluating the php code.

#7 @bpetty
3 years ago

You should look into your default_mimetype PHP INI setting. Since this is Apache, you might have override for PHP ini settings. Try this:

php_value default_mimetype text/html

#8 follow-up: @nacin
3 years ago

  • Component changed from Validation to Template

I could go for ticket-25863-xmlns-removal.patch, though I am not particularly familiar with the ramifications of it.

#9 @nacin
3 years ago

  • Component changed from Template to General
  • Focuses template added

#10 in reply to: ↑ 8 @obenland
3 years ago

Replying to nacin:

I could go for ticket-25863-xmlns-removal.patch, though I am not particularly familiar with the ramifications of it.

I don't think there should be any. By default, User Agents conforming to the HTML5 specification will place HTML elements in the http://www.w3.org/1999/xhtml namespace (Source).

#11 @obenland
2 years ago

  • Milestone changed from Awaiting Review to Future Release

20 months ago

remove tinymce file from the changes.

This ticket was mentioned in Slack in #core by sergey. View the logs.

15 months ago

Note: See TracTickets for help on using tickets.