Twiddling bits for over 30 years

Home / Blogs / eZ Blog / Turning off debug for xml output

Turning off debug for xml output

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|application)/(xml|json).*@', 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.