Ticket #7537: 7537.diff
File 7537.diff, 1.3 KB (added by , 16 years ago) |
---|
-
wp-includes/canonical.php
157 157 $redirect['path'] = preg_replace( '#(%20| )+$#', '', $redirect['path'] ); 158 158 159 159 // Remove trailing slashes from certain terminating query string args 160 $redirect['query'] = preg_replace( '#((p|page_id|cat|tag)=[^&]*?)(%20| )+$#', '$1', $redirect['query'] );160 $redirect['query'] = isset($redirect['query']) ? preg_replace( '#((p|page_id|cat|tag)=[^&]*?)(%20| )+$#', '$1', $redirect['query'] ) : ''; 161 161 162 162 // Clean up empty query strings 163 163 $redirect['query'] = preg_replace( '#&?(p|page_id|cat|tag)=?$#', '', $redirect['query'] ); … … 206 206 if ( isset( $redirect['port'] ) ) 207 207 $compare_redirect[] = $redirect['port']; 208 208 209 if ( isset( $redirect['query'] ) )209 if ( ! empty( $redirect['query'] ) ) 210 210 $compare_redirect[] = $redirect['query']; 211 211 212 212 if ( $compare_original !== $compare_redirect ) { … … 214 214 if ( isset($redirect['port']) ) 215 215 $redirect_url .= ':' . $redirect['port']; 216 216 $redirect_url .= $redirect['path']; 217 if ( $redirect['query'])217 if ( ! empty($redirect['query']) ) 218 218 $redirect_url .= '?' . $redirect['query']; 219 219 } 220 220