Moodle
  1. Moodle
  2. MDL-7883

'application/xhtml' and XHTML Strict preferred, initially in debug mode

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.7
    • Fix Version/s: None
    • Component/s: General
    • Labels:
      None
    • Environment:
      Components: Markup, Standards

      Tests server variables: HTTP_ACCEPT, HTTP_USER_AGENT
    • Database:
      Any
    • Affected Branches:
      MOODLE_17_STABLE
    • Rank:
      11783

      Description

      http://www.w3.org/TR/2002/NOTE-xhtml-media-types-20020801/

      Just seen Bug MDL-7861 - I've been looking at something similar, initially for debugging. In DEBUG_DEVELOPER mode this patch delivers pages as the preferred 'application/xhtml+xml' mime-type to supporting browsers (Firefox, Opera, iCab... Safari issue with character entities, http://www.w3.org/2000/07/8378/xhtml/entities) and 'application/xml' for Win-IE 5+ (http://www.w3.org/MarkUp/2004/xhtml-faq#ie). Other browsers get 'text/html'.

      An XML well-formed bug (stray &, unquoted attributes...) leads to an XHTML browser displaying an error message in place of the page, which should be useful for developers. (Note, an on/off switch may be useful to aid diagnosis.)

      The patch also substitutes the XHTML Strict document-type declaration in DEBUG_NORMAL mode - note, error messages aren't displayed in the browser, a 3rd party validator is required.

        Issue Links

          Activity

          Hide
          Nick Freear added a comment -

          Already spotted markup errors (MDL-7884) using this patch! I await feedback with interest

          Show
          Nick Freear added a comment - Already spotted markup errors ( MDL-7884 ) using this patch! I await feedback with interest
          Hide
          Martin Dougiamas added a comment -

          Looks really useful, thanks! I'll put this in HEAD right away.

          Show
          Martin Dougiamas added a comment - Looks really useful, thanks! I'll put this in HEAD right away.
          Hide
          Martin Dougiamas added a comment -

          I'll resolve this and we can log XHTML 1.0 strict fixes against MDL-7861

          Show
          Martin Dougiamas added a comment - I'll resolve this and we can log XHTML 1.0 strict fixes against MDL-7861
          Hide
          Jon Papaioannou added a comment -

          I 've just had an unpleasant encounter with this feature in the MOODLE_18_STABLE branch. It's true that there were compliance errors that have gone unnoticed so far (that's why it bit me right now) and possibly could continue to go unnoticed in the future.

          That's how this feature is a good thing.

          It's also a BAD thing in its own way though:

          1. It caused me a "WHAT?!?! Is Moodle served as XML by default?!?!?!" panic moment.

          For people who haven't read such discussions, the one-sentence summary is:
          We will never be able to serve Moodle as an XML content-type, because the page could contain validation errors caused from user content (or from aggregated content) and the side effect (ugly error message, total shutdown) is unacceptable to the end user.

          Sometimes you need to serve as XML (e.g. to use MathML), in which case you have to put up with this. But it's not doable in the general case. Please research the subject if you feel that I have not convinced you on the extent of the problem.

          2. It forced me to find out why XML was being served and fix it on the spot, when I 'd much rather be doing what I originally set out to do.

          So, considering that there are other good ways (FF's Web Dev Toolbar) to always catch validation errors, it might be a good idea to have a way to turn this feature off while keeping debugging on and still using FF.

          Just my 2 cents.

          Show
          Jon Papaioannou added a comment - I 've just had an unpleasant encounter with this feature in the MOODLE_18_STABLE branch. It's true that there were compliance errors that have gone unnoticed so far (that's why it bit me right now) and possibly could continue to go unnoticed in the future. That's how this feature is a good thing. It's also a BAD thing in its own way though: 1. It caused me a "WHAT?!?! Is Moodle served as XML by default?!?!?!" panic moment. For people who haven't read such discussions, the one-sentence summary is: We will never be able to serve Moodle as an XML content-type, because the page could contain validation errors caused from user content (or from aggregated content) and the side effect (ugly error message, total shutdown) is unacceptable to the end user. Sometimes you need to serve as XML (e.g. to use MathML), in which case you have to put up with this. But it's not doable in the general case. Please research the subject if you feel that I have not convinced you on the extent of the problem. 2. It forced me to find out why XML was being served and fix it on the spot, when I 'd much rather be doing what I originally set out to do. So, considering that there are other good ways (FF's Web Dev Toolbar) to always catch validation errors, it might be a good idea to have a way to turn this feature off while keeping debugging on and still using FF. Just my 2 cents.
          Hide
          Jeffrey Silverman added a comment -

          Now, some time later, my $0.02.

          There should be some sort of warning in the admin page text for "xmlstrictheaders" setting that says "You WILL break your site!!"

          It is very easy to completely disable a site by turning xmlstrictheaders on!

          Also, it seems like that setting will apply only to debug mode, but, in fact, it stays on even when debug and debugdisplay are both 0.

          This is as of Moodle 1.9.4+

          Thanks!

          Show
          Jeffrey Silverman added a comment - Now, some time later, my $0.02. There should be some sort of warning in the admin page text for "xmlstrictheaders" setting that says "You WILL break your site!!" It is very easy to completely disable a site by turning xmlstrictheaders on! Also, it seems like that setting will apply only to debug mode, but, in fact, it stays on even when debug and debugdisplay are both 0. This is as of Moodle 1.9.4+ Thanks!

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: