Make WordPress Core

Ticket #62950: 62950.patch

File 62950.patch, 634 bytes (added by sainathpoojary, 11 months ago)

The issue occurred because $string was uninitialized when $feedback was neither an error nor a string, resulting in null being passed to str_contains() and trim(), which is deprecated in PHP 8.2. This fix ensures $string is always initialized as an empty string before use, preventing these warnings.

  • src/wp-admin/includes/class-automatic-upgrader-skin.php

    diff --git a/src/wp-admin/includes/class-automatic-upgrader-skin.php b/src/wp-admin/includes/class-automatic-upgrader-skin.php
    index 4fee6205fc..952b5cd491 100644
    a b class Automatic_Upgrader_Skin extends WP_Upgrader_Skin { 
    7272         * @param mixed                 ...$args  Optional text replacements.
    7373         */
    7474        public function feedback( $feedback, ...$args ) {
     75                $string = '';
     76
    7577                if ( is_wp_error( $feedback ) ) {
    7678                        $string = $feedback->get_error_message();
    7779                } elseif ( is_array( $feedback ) ) {