Debug Bar - Version 1.1.3

Version Description

  • Fix notices in HTTP Requests panel when a request is stopped/doesn't finish.
  • Decode the SQL in the WP_Query panel.
Download this release

Release Info

Developer aidvu
Plugin Icon 128x128 Debug Bar
Version 1.1.3
Comparing to
See all releases

Code changes from version 1.1.2 to 1.1.3

debug-bar.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin URI: https://wordpress.org/plugins/debug-bar/
5
  Description: Adds a debug menu to the admin bar that shows query, cache, and other helpful debugging information.
6
  Author: wordpressdotorg
7
- Version: 1.1.2
8
  Author URI: https://wordpress.org/
9
  Text Domain: debug-bar
10
  */
4
  Plugin URI: https://wordpress.org/plugins/debug-bar/
5
  Description: Adds a debug menu to the admin bar that shows query, cache, and other helpful debugging information.
6
  Author: wordpressdotorg
7
+ Version: 1.1.3
8
  Author URI: https://wordpress.org/
9
  Text Domain: debug-bar
10
  */
panels/class-debug-bar-wp-http.php CHANGED
@@ -58,7 +58,8 @@ class Debug_Bar_WP_Http extends Debug_Bar_Panel {
58
 
59
  function is_request_error( $response ) {
60
  if (
61
- is_wp_error( $response )
 
62
  || $response['response']['code'] >= 400
63
  ) {
64
  return true;
@@ -157,8 +158,8 @@ HTML;
157
  foreach( $this->requests as $i => $r ) {
158
  $class = '';
159
  if (
160
- $this->is_request_error( $r['r'] )
161
- || $r['args']['duration'] > $this->time_limit
162
  ) {
163
  $class = 'err';
164
  }
@@ -167,14 +168,20 @@ HTML;
167
  $start *= 1000;
168
  $start = number_format( $start, 1 );
169
 
170
- $duration = number_format( $r['args']['duration'], 1 );
 
 
 
171
  $method = esc_html( $r['args']['method'] );
172
  $url = esc_html( $r['url'] );
173
 
174
- if ( is_wp_error( $r['r'] ) ) {
175
  $code = esc_html( $r['r']->get_error_code() );
176
  } else {
177
- $code = esc_html( $r['r']['response']['code'] );
 
 
 
178
  }
179
 
180
  $details = esc_html( print_r( $r, true ) );
@@ -184,7 +191,7 @@ HTML;
184
  <tr class="{$class}">
185
  <td><a onclick="debug_bar_http_toggle( '{$record_id}' );">Toggle</a></td>
186
  <td>{$start} ms</td>
187
- <td>{$duration} ms</td>
188
  <td>{$method}</td>
189
  <td>{$url}</td>
190
  <td>{$code}</td>
58
 
59
  function is_request_error( $response ) {
60
  if (
61
+ empty( $response )
62
+ || is_wp_error( $response )
63
  || $response['response']['code'] >= 400
64
  ) {
65
  return true;
158
  foreach( $this->requests as $i => $r ) {
159
  $class = '';
160
  if (
161
+ ( ! empty( $r['r'] ) && $this->is_request_error( $r['r'] ) )
162
+ || ( ! empty( $r['args']['duration'] ) && $r['args']['duration'] > $this->time_limit )
163
  ) {
164
  $class = 'err';
165
  }
168
  $start *= 1000;
169
  $start = number_format( $start, 1 );
170
 
171
+ $duration = 'error getting request duration';
172
+ if ( ! empty( $r['args']['duration'] ) ) {
173
+ $duration = number_format( $r['args']['duration'], 1 ) . ' ms';
174
+ }
175
  $method = esc_html( $r['args']['method'] );
176
  $url = esc_html( $r['url'] );
177
 
178
+ if ( ! empty( $r['r'] ) && is_wp_error( $r['r'] ) ) {
179
  $code = esc_html( $r['r']->get_error_code() );
180
  } else {
181
+ $code = 'error getting response code, most likely a stopped request';
182
+ if ( ! empty( $r['r']['response']['code'] ) ) {
183
+ $code = esc_html( $r['r']['response']['code'] );
184
+ }
185
  }
186
 
187
  $details = esc_html( print_r( $r, true ) );
191
  <tr class="{$class}">
192
  <td><a onclick="debug_bar_http_toggle( '{$record_id}' );">Toggle</a></td>
193
  <td>{$start} ms</td>
194
+ <td>{$duration}</td>
195
  <td>{$method}</td>
196
  <td>{$url}</td>
197
  <td>{$code}</td>
panels/class-debug-bar-wp-query.php CHANGED
@@ -10,7 +10,7 @@ class Debug_Bar_WP_Query extends Debug_Bar_Panel {
10
  }
11
 
12
  function render() {
13
- global $template, $wp_query;
14
 
15
  $queried_object = get_queried_object();
16
  if ( $queried_object && isset( $queried_object->post_type ) ) {
@@ -87,7 +87,11 @@ class Debug_Bar_WP_Query extends Debug_Bar_Panel {
87
 
88
  if ( ! empty( $wp_query->request ) ) {
89
  echo '<h3>', __( 'Query SQL:', 'debug-bar' ), '</h3>';
90
- echo '<p>' . esc_html( $wp_query->request ) . '</p>';
 
 
 
 
91
  }
92
 
93
  if ( ! is_null( $queried_object ) ) {
10
  }
11
 
12
  function render() {
13
+ global $template, $wp_query, $wpdb;
14
 
15
  $queried_object = get_queried_object();
16
  if ( $queried_object && isset( $queried_object->post_type ) ) {
87
 
88
  if ( ! empty( $wp_query->request ) ) {
89
  echo '<h3>', __( 'Query SQL:', 'debug-bar' ), '</h3>';
90
+ if ( is_callable( array( $wpdb, 'remove_placeholder_escape' ) ) ) {
91
+ echo '<p>' . esc_html( $wpdb->remove_placeholder_escape( $wp_query->request ) ) . '</p>';
92
+ } else {
93
+ echo '<p>' . esc_html( $wp_query->request ) . '</p>';
94
+ }
95
  }
96
 
97
  if ( ! is_null( $queried_object ) ) {
readme.txt CHANGED
@@ -1,8 +1,8 @@
1
  === Debug Bar ===
2
  Contributors: wordpressdotorg, ryan, westi, koopersmith, duck_, mitchoyoshitaka, dd32, jrf, obenland, nacin, evansolomon, Otto42, aidvu, josephscott
3
  Tags: debug
4
- Tested up to: 5.5.3
5
- Stable tag: 1.1.2
6
  Requires at least: 3.4
7
 
8
  Adds a debug menu to the admin bar that shows query, cache, and other helpful debugging information.
@@ -29,6 +29,10 @@ There are numerous other add-ons available to get more insight into, for instanc
29
 
30
  == Upgrade Notice ==
31
 
 
 
 
 
32
  = 1.1.2 =
33
  Fix error checking in HTTP Requests panel.
34
 
@@ -115,6 +119,10 @@ Initial Release
115
 
116
  == Changelog ==
117
 
 
 
 
 
118
  = 1.1.2 =
119
  Fix error checking in HTTP Requests panel.
120
 
1
  === Debug Bar ===
2
  Contributors: wordpressdotorg, ryan, westi, koopersmith, duck_, mitchoyoshitaka, dd32, jrf, obenland, nacin, evansolomon, Otto42, aidvu, josephscott
3
  Tags: debug
4
+ Tested up to: 6.1
5
+ Stable tag: 1.1.3
6
  Requires at least: 3.4
7
 
8
  Adds a debug menu to the admin bar that shows query, cache, and other helpful debugging information.
29
 
30
  == Upgrade Notice ==
31
 
32
+ = 1.1.3 =
33
+ - Fix notices in HTTP Requests panel when a request is stopped/doesn't finish.
34
+ - Decode the SQL in the WP_Query panel.
35
+
36
  = 1.1.2 =
37
  Fix error checking in HTTP Requests panel.
38
 
119
 
120
  == Changelog ==
121
 
122
+ = 1.1.3 =
123
+ - Fix notices in HTTP Requests panel when a request is stopped/doesn't finish.
124
+ - Decode the SQL in the WP_Query panel.
125
+
126
  = 1.1.2 =
127
  Fix error checking in HTTP Requests panel.
128