From 48f8665e2dbc71b2c6258fe1969202c058506c5c Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Wed, 4 Nov 2015 13:35:32 +0000 Subject: [PATCH] Hide SQL errors during ajax requests Avoids invalid JSON --- includes/class-wc-ajax.php | 1 + 1 file changed, 1 insertion(+) diff --git a/includes/class-wc-ajax.php b/includes/class-wc-ajax.php index c259a870f28..15dead566f0 100644 --- a/includes/class-wc-ajax.php +++ b/includes/class-wc-ajax.php @@ -50,6 +50,7 @@ class WC_AJAX { if ( ! WP_DEBUG || ( WP_DEBUG && ! WP_DEBUG_DISPLAY ) ) { @ini_set( 'display_errors', 0 ); } + $GLOBALS['wpdb']->hide_errors(); // Send headers like admin-ajax.php send_origin_headers(); @header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) );