From 1c55ce248257c321b33eeda0ea121f9e1fdc0468 Mon Sep 17 00:00:00 2001 From: hellofromTonya Date: Mon, 20 Sep 2021 18:22:57 +0000 Subject: [PATCH] Login and Registration: Fix "passing null to non-nullable" deprecation for `authorize_application` error message. If there is no URL query in the `$_GET['redirect_to'], `wp_parse_url()` will return `null`. Passing `null` to `parse_str()` results in a PHP 8.1 deprecation notice {{{ Deprecated: parse_str(): Passing null to parameter #1 ($string) of type string is deprecated }}} This commit: - Fixes the deprecation notice. - Skips doing the `parse_str()` when there's no URL query. - Provides a micro-optimization performance boost. Follow-up to [49109]. Props jrf, hellofromTonya, BinaryKitten. See #53635. Built from https://develop.svn.wordpress.org/trunk@51829 git-svn-id: http://core.svn.wordpress.org/trunk@51436 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/version.php | 2 +- wp-login.php | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/wp-includes/version.php b/wp-includes/version.php index ad75eb2601..fa0f19b80b 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '5.9-alpha-51828'; +$wp_version = '5.9-alpha-51829'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. diff --git a/wp-login.php b/wp-login.php index 11517dac21..0d030863ed 100644 --- a/wp-login.php +++ b/wp-login.php @@ -1267,7 +1267,10 @@ switch ( $action ) { $errors->add( 'enter_recovery_mode', __( 'Recovery Mode Initialized. Please log in to continue.' ), 'message' ); } elseif ( isset( $_GET['redirect_to'] ) && false !== strpos( $_GET['redirect_to'], 'wp-admin/authorize-application.php' ) ) { $query_component = wp_parse_url( $_GET['redirect_to'], PHP_URL_QUERY ); - parse_str( $query_component, $query ); + $query = array(); + if ( $query_component ) { + parse_str( $query_component, $query ); + } if ( ! empty( $query['app_name'] ) ) { /* translators: 1: Website name, 2: Application name. */