Blogs / Steven E. Bailey / Turning off debug for xml output

Turning off debug for xml output

Friday 19 August 2011 12:52:33 am

  • Currently 5 out of 5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

By : Steven E. Bailey

So I'm trying to debug a site which has ajax calls to a module that serves xml.  Of course the debug output appended to the xml breaks it.  I've had this problem before but I never bothered looking closer at it until now.

So, I added this:

    if (preg_grep('@Content-Type: text/xml.*@', headers_list() ) )
        return null;

to index.php right after the:

     if ( $ini->variable( 'DebugSettings', 'DebugOutput' ) != 'enabled' )
        return null;

check in the eZDisplayDebug function.  Works like a charm.

So, worth a git pull?  Maybe it should be anything that's not "text/html" instead?  Is there some eZ way of doing this that I overlooked?

Blog Post Discussion

Turning off debug for xml output