From 3f32bf7bc0f852317c80eb743fcd2244ac6bb834 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Thu, 21 May 2015 20:30:25 +0000 Subject: [PATCH] In `canonical.php`: * Clarify some docs * `redirect_canonical()` inconsistently returns `null` or `false` when bailing - can simply return. See #32444. Built from https://develop.svn.wordpress.org/trunk@32529 git-svn-id: http://core.svn.wordpress.org/trunk@32499 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/canonical.php | 18 ++++++++++-------- wp-includes/version.php | 2 +- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/wp-includes/canonical.php b/wp-includes/canonical.php index 5f4bda087e..046c4ee463 100644 --- a/wp-includes/canonical.php +++ b/wp-includes/canonical.php @@ -33,8 +33,7 @@ * @param string $requested_url Optional. The URL that was requested, used to * figure if redirect is needed. * @param bool $do_redirect Optional. Redirect to the new URL. - * @return null|false|string Null, if redirect not needed. False, if redirect - * not needed or the string of the URL + * @return null|string Null, if redirect not needed, or the string of the URL */ function redirect_canonical( $requested_url = null, $do_redirect = true ) { global $wp_rewrite, $is_IIS, $wp_query, $wpdb; @@ -447,8 +446,9 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) { $redirect_url .= '?' . $redirect['query']; } - if ( !$redirect_url || $redirect_url == $requested_url ) - return false; + if ( ! $redirect_url || $redirect_url == $requested_url ) { + return; + } // Hex encoded octets are case-insensitive. if ( false !== strpos($requested_url, '%') ) { @@ -472,8 +472,10 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) { */ $redirect_url = apply_filters( 'redirect_canonical', $redirect_url, $requested_url ); - if ( !$redirect_url || $redirect_url == $requested_url ) // yes, again -- in case the filter aborted the request - return false; + // yes, again -- in case the filter aborted the request + if ( ! $redirect_url || $redirect_url == $requested_url ) { + return; + } if ( $do_redirect ) { // protect against chained redirects @@ -483,7 +485,7 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) { } else { // Debug // die("1: $redirect_url
2: " . redirect_canonical( $redirect_url, false ) ); - return false; + return; } } else { return $redirect_url; @@ -523,7 +525,7 @@ function _remove_qs_args_if_not_in_url( $query_string, Array $args_to_check, $ur * * @global wpdb $wpdb WordPress database abstraction object. * - * @return bool|string The correct URL if one is found. False on failure. + * @return false|string The correct URL if one is found. False on failure. */ function redirect_guess_404_permalink() { global $wpdb, $wp_rewrite; diff --git a/wp-includes/version.php b/wp-includes/version.php index c7503daa61..9580d9c654 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.3-alpha-32528'; +$wp_version = '4.3-alpha-32529'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.