HTTP API: Update WP_Http class to avoid PHP deprecation warnings.

This changeset prevents a PHP 8.3 deprecation shown when enabling debug and calling `get_class()` without arguments.

For more info about this deprecation, see https://wiki.php.net/rfc/deprecate_functions_with_overloaded_signatures#get_class_and_get_parent_class.

Props ipajen, rajinsharwar, SergeyBiryukov, jrf.
Fixes #58876.





git-svn-id: https://develop.svn.wordpress.org/trunk@56495 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jb Audras
2023-08-30 22:07:13 +00:00
parent bc92bb0cba
commit 98284ae792

View File

@@ -326,11 +326,11 @@ class WP_Http {
);
// Ensure redirects follow browser behavior.
$options['hooks']->register( 'requests.before_redirect', array( get_class(), 'browser_redirect_compatibility' ) );
$options['hooks']->register( 'requests.before_redirect', array( static::class, 'browser_redirect_compatibility' ) );
// Validate redirected URLs.
if ( function_exists( 'wp_kses_bad_protocol' ) && $parsed_args['reject_unsafe_urls'] ) {
$options['hooks']->register( 'requests.before_redirect', array( get_class(), 'validate_redirects' ) );
$options['hooks']->register( 'requests.before_redirect', array( static::class, 'validate_redirects' ) );
}
if ( $parsed_args['stream'] ) {