Make WordPress Core

Changeset 56495


Ignore:
Timestamp:
08/30/2023 10:07:13 PM (9 months ago)
Author:
audrasjb
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-http.php

    r55988 r56495  
    327327
    328328        // Ensure redirects follow browser behavior.
    329         $options['hooks']->register( 'requests.before_redirect', array( get_class(), 'browser_redirect_compatibility' ) );
     329        $options['hooks']->register( 'requests.before_redirect', array( static::class, 'browser_redirect_compatibility' ) );
    330330
    331331        // Validate redirected URLs.
    332332        if ( function_exists( 'wp_kses_bad_protocol' ) && $parsed_args['reject_unsafe_urls'] ) {
    333             $options['hooks']->register( 'requests.before_redirect', array( get_class(), 'validate_redirects' ) );
     333            $options['hooks']->register( 'requests.before_redirect', array( static::class, 'validate_redirects' ) );
    334334        }
    335335
Note: See TracChangeset for help on using the changeset viewer.