Query Monitor - Version 2.5.6

Version Description

  • Fix the "Invalid header" issue. Woo!
Download this release

Release Info

Developer johnbillion
Plugin Icon 128x128 Query Monitor
Version 2.5.6
Comparing to
See all releases

Code changes from version 2.5.5 to 2.5.6

assets/query-monitor.js CHANGED
@@ -131,14 +131,14 @@ jQuery( function($) {
131
  if ( !errors )
132
  return event;
133
 
134
- errors = $.parseJSON( errors );
135
 
136
- for ( var key in errors ) {
137
 
138
- error = $.parseJSON( response.getResponseHeader( 'X-QM-Error-' + errors[key] ) );
139
 
140
  if ( window.console ) {
141
- console.debug( '=== PHP Error in AJAX Response ===' ); // @TODO i18n
142
  console.debug( error );
143
  }
144
 
@@ -146,7 +146,7 @@ jQuery( function($) {
146
  if ( ! qm.ajax_errors[error.type] ) {
147
  $('#wp-admin-bar-query-monitor')
148
  .addClass('qm-'+error.type)
149
- .find('a').first().append('<span class="qm-ajax-'+ error.type +'"> / AJAX: '+ error.type +'</span>')
150
  ;
151
  }
152
  }
131
  if ( !errors )
132
  return event;
133
 
134
+ errors = parseInt( errors, 10 );
135
 
136
+ for ( var key = 1; key <= errors; key++ ) {
137
 
138
+ error = $.parseJSON( response.getResponseHeader( 'X-QM-Error-' + key ) );
139
 
140
  if ( window.console ) {
141
+ console.debug( '=== ' + qm_l10n.ajax_error + ' ===' );
142
  console.debug( error );
143
  }
144
 
146
  if ( ! qm.ajax_errors[error.type] ) {
147
  $('#wp-admin-bar-query-monitor')
148
  .addClass('qm-'+error.type)
149
+ .find('a').first().append('<span class="ab-label qm-ajax-'+ error.type +'"> &nbsp; AJAX: '+ error.type +'</span>')
150
  ;
151
  }
152
  }
components/php_errors.php CHANGED
@@ -69,25 +69,37 @@ class QM_Component_PHP_Errors extends QM_Component {
69
  if ( empty( $data['errors'] ) )
70
  return;
71
 
72
- $all_errors = array();
73
 
74
  foreach ( $data['errors'] as $type => $errors ) {
75
 
76
  foreach ( $errors as $key => $error ) {
77
 
78
- $all_errors[$key] = $key;
 
 
 
 
 
 
 
 
 
 
 
 
79
 
80
- header( sprintf( 'X-QM-Error-%s: %s',
81
- $key,
82
- json_encode( $error )
83
  ) );
84
 
85
  }
86
 
87
  }
88
 
89
- header( sprintf( 'X-QM-Errors: %s',
90
- json_encode( $all_errors )
91
  ) );
92
 
93
  }
@@ -228,6 +240,8 @@ function register_qm_php_errors( array $qm ) {
228
  }
229
 
230
  function qm_php_errors_return_value( $return ) {
 
 
231
  # If Xdebug is enabled we'll return false so Xdebug's error handler can do its thing.
232
  if ( function_exists( 'xdebug_is_enabled' ) and xdebug_is_enabled() )
233
  return false;
69
  if ( empty( $data['errors'] ) )
70
  return;
71
 
72
+ $count = 0;
73
 
74
  foreach ( $data['errors'] as $type => $errors ) {
75
 
76
  foreach ( $errors as $key => $error ) {
77
 
78
+ $count++;
79
+
80
+ # @TODO we should calculate the component during process() so we don't need to do it
81
+ # separately in output_html() and output_headers().
82
+ $component = QM_Util::get_backtrace_component( $error->trace );
83
+ $output_error = array(
84
+ 'type' => $error->type,
85
+ 'message' => $error->message,
86
+ 'file' => $error->file,
87
+ 'line' => $error->line,
88
+ 'stack' => $error->trace->get_stack(),
89
+ 'component' => $component->name,
90
+ );
91
 
92
+ header( sprintf( 'X-QM-Error-%d: %s',
93
+ $count,
94
+ json_encode( $output_error )
95
  ) );
96
 
97
  }
98
 
99
  }
100
 
101
+ header( sprintf( 'X-QM-Errors: %d',
102
+ $count
103
  ) );
104
 
105
  }
240
  }
241
 
242
  function qm_php_errors_return_value( $return ) {
243
+ if ( QM_Util::is_ajax() )
244
+ return true;
245
  # If Xdebug is enabled we'll return false so Xdebug's error handler can do its thing.
246
  if ( function_exists( 'xdebug_is_enabled' ) and xdebug_is_enabled() )
247
  return false;
query-monitor.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Query Monitor
4
  Description: Monitoring of database queries, hooks, conditionals and more.
5
- Version: 2.5.5
6
  Plugin URI: https://github.com/johnbillion/QueryMonitor
7
  Author: John Blackbourn
8
  Author URI: https://johnblackbourn.com/
@@ -230,6 +230,13 @@ class QueryMonitor extends QM_Plugin {
230
  'qm_locale',
231
  (array) $wp_locale
232
  );
 
 
 
 
 
 
 
233
 
234
  }
235
 
2
  /*
3
  Plugin Name: Query Monitor
4
  Description: Monitoring of database queries, hooks, conditionals and more.
5
+ Version: 2.5.6
6
  Plugin URI: https://github.com/johnbillion/QueryMonitor
7
  Author: John Blackbourn
8
  Author URI: https://johnblackbourn.com/
230
  'qm_locale',
231
  (array) $wp_locale
232
  );
233
+ wp_localize_script(
234
+ 'query-monitor',
235
+ 'qm_l10n',
236
+ array(
237
+ 'ajax_error' => __( 'PHP Error in AJAX Response', 'query-monitor' ),
238
+ )
239
+ );
240
 
241
  }
242
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: johnbillion
3
  Tags: debug, debugging, development, developer, performance, profiler, profiling, queries
4
  Requires at least: 3.5
5
  Tested up to: 3.8
6
- Stable tag: 2.5.5
7
  License: GPLv2 or later
8
 
9
  View debugging and performance information on database queries, hooks, conditionals, HTTP requests, redirects and more.
@@ -110,6 +110,9 @@ I know!
110
 
111
  == Changelog ==
112
 
 
 
 
113
  = 2.5.5 =
114
  * Better layout for the Hooks panel
115
  * Fix some AJAX issues
3
  Tags: debug, debugging, development, developer, performance, profiler, profiling, queries
4
  Requires at least: 3.5
5
  Tested up to: 3.8
6
+ Stable tag: 2.5.6
7
  License: GPLv2 or later
8
 
9
  View debugging and performance information on database queries, hooks, conditionals, HTTP requests, redirects and more.
110
 
111
  == Changelog ==
112
 
113
+ = 2.5.6 =
114
+ * Fix the "Invalid header" issue. Woo!
115
+
116
  = 2.5.5 =
117
  * Better layout for the Hooks panel
118
  * Fix some AJAX issues
wp-content/db.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /*
3
- Plugin Name: Query Monitor
4
 
5
  *********************************************************************
6
 
1
  <?php
2
  /*
3
+ Plugin Name: Query Monitor Database Class
4
 
5
  *********************************************************************
6