Skip to content

Conversation

@jom
Copy link
Member

@jom jom commented Oct 27, 2017

Fixes Automattic/jetpack#25583

Prevents debug output on XHR or REST API requests.

@jom jom requested a review from donnchawp October 27, 2017 16:32
@jom jom added this to the 1.5.9 milestone Oct 27, 2017
@stodorovic
Copy link

stodorovic commented Oct 27, 2017

I just looked this PR. Function wp_super_cache_query_vars is called before wp_cache_add_to_buffer. So it's safe to we use isset( $wp_super_cache_query[ 'is_rest' ] ).

I think that's better to avoid repeating same code snippet and alternative could be:

if ( strpos( $buffer, '<html' ) === false ||
     isset( $wp_super_cache_query[ 'is_rest' ] ) ||
     isset( $wp_super_cache_query[ 'is_feed' ] )
) {

Maybe we can keep comments for is_feed, I'm not sure. Also first condition is true in almost all cases (for XML files).

Related to AJAX request, we don't need anything special because output buffer isn't created. Also, I've created PR #384 and function wpsc_is_backend which covers more cases - cron requests, xlmrpc, wp-login, wp-cli and various PHP scripts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Debug should not break XML/JSON

3 participants