diff --git a/wp-admin/plugin-editor.php b/wp-admin/plugin-editor.php
index 36dce7795d..800e468f3f 100644
--- a/wp-admin/plugin-editor.php
+++ b/wp-admin/plugin-editor.php
@@ -312,10 +312,12 @@ if ( ! in_array( 'plugin_editor_notice', $dismissed_pointers, true ) ) :
$excluded_referer_basenames = array( 'plugin-editor.php', 'wp-login.php' );
- if ( $referer && ! in_array( basename( parse_url( $referer, PHP_URL_PATH ) ), $excluded_referer_basenames, true ) ) {
- $return_url = $referer;
- } else {
- $return_url = admin_url( '/' );
+ $return_url = admin_url( '/' );
+ if ( $referer ) {
+ $referer_path = parse_url( $referer, PHP_URL_PATH );
+ if ( is_string( $referer_path ) && ! in_array( basename( $referer_path ), $excluded_referer_basenames, true ) ) {
+ $return_url = $referer;
+ }
}
?>
diff --git a/wp-admin/theme-editor.php b/wp-admin/theme-editor.php
index 572a2d82c4..46926df87c 100644
--- a/wp-admin/theme-editor.php
+++ b/wp-admin/theme-editor.php
@@ -343,10 +343,12 @@ if ( ! in_array( 'theme_editor_notice', $dismissed_pointers, true ) ) :
$excluded_referer_basenames = array( 'theme-editor.php', 'wp-login.php' );
- if ( $referer && ! in_array( basename( parse_url( $referer, PHP_URL_PATH ) ), $excluded_referer_basenames, true ) ) {
- $return_url = $referer;
- } else {
- $return_url = admin_url( '/' );
+ $return_url = admin_url( '/' );
+ if ( $referer ) {
+ $referer_path = parse_url( $referer, PHP_URL_PATH );
+ if ( is_string( $referer_path ) && ! in_array( basename( $referer_path ), $excluded_referer_basenames, true ) ) {
+ $return_url = $referer;
+ }
}
?>
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 9564325273..d8b5addf4d 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
-$wp_version = '5.9-alpha-51628';
+$wp_version = '5.9-alpha-51629';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.