jetpack icon indicating copy to clipboard operation
jetpack copied to clipboard

Debug should not break XML/JSON

Open kraftbj opened this issue 8 years ago • 4 comments

We should probably not output any debug messages if DOING_AJAX, XMLRPC_REQUEST, or REST_REQUEST.

kraftbj avatar Dec 01 '15 07:12 kraftbj

It'd be good to also include JSON_REQUEST in this and 02d6a8e800be11291a7e5b4954fcd5ef4d93d778, for those running v1 of the REST API.

Related Automattic/wp-super-cache#22

iandunn avatar Dec 30 '15 23:12 iandunn

Actually, I don't think v1 support is all that important anymore. I think most custom v1 endpoints have migrated to v2, or will soon.

iandunn avatar Jun 08 '16 00:06 iandunn

ref: wp_cache_add_to_buffer() https://github.com/Automattic/wp-super-cache/blob/f4cab722d73b88bac12042e2865be1fd3dc5042c/wp-cache-phase2.php#L593-L608

jom avatar Oct 26 '17 14:10 jom

While that strpos will more than likely stop the plugin writing out html comments to non-html content we could also add in checks for those constants. I merged in a change that checked for various REST protocols yesterday, so the wp_cache_add_to_buffer() function could do something similar..

https://github.com/Automattic/wp-super-cache/blob/f4cab722d73b88bac12042e2865be1fd3dc5042c/wp-cache-phase2.php#L377-L380

donnchawp avatar Oct 26 '17 16:10 donnchawp