From 366d370d37a78229eeaefa877f4817a5d75f3d62 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Fri, 29 Dec 2023 13:54:17 +0000 Subject: [PATCH] Canonical: Check if the `author` parameter is a string in `redirect_canonical()`. This avoids a PHP warning or error when viewing an author on the front end, while an array is passed as `$_GET['author']`. Follow-up to [12034], [12040], [12202]. Props david.binda, antonvlasenko, azaozz, SergeyBiryukov. Fixes #60059. Built from https://develop.svn.wordpress.org/trunk@57232 git-svn-id: http://core.svn.wordpress.org/trunk@56738 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/canonical.php | 4 +++- wp-includes/version.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/wp-includes/canonical.php b/wp-includes/canonical.php index 040567fd0e..0b94791fd9 100644 --- a/wp-includes/canonical.php +++ b/wp-includes/canonical.php @@ -316,7 +316,9 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) { $redirect['query'] = remove_query_arg( 'year', $redirect['query'] ); } } - } elseif ( is_author() && ! empty( $_GET['author'] ) && preg_match( '|^[0-9]+$|', $_GET['author'] ) ) { + } elseif ( is_author() && ! empty( $_GET['author'] ) + && is_string( $_GET['author'] ) && preg_match( '|^[0-9]+$|', $_GET['author'] ) + ) { $author = get_userdata( get_query_var( 'author' ) ); if ( false !== $author diff --git a/wp-includes/version.php b/wp-includes/version.php index 5d17ec03da..1e02536a68 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.5-alpha-57231'; +$wp_version = '6.5-alpha-57232'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.