Make WordPress Core


Ignore:
Timestamp:
09/29/2025 04:28:00 PM (12 months ago)
Author:
swissspidy
Message:

Code Modernization: Fix instances of using null as an array offset.

Addresses a new ​deprecation in PHP 8.5.

Props swissspidy.
Fixes #63957.

File:
1 edited

Legend:

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

    r60776 r60809  
    51025102                         * than `array_key_exists()`.
    51035103                         */
    5104                         if ( isset( $input_array[ $path_element ] ) ) {
     5104                        if ( isset( $path_element, $input_array[ $path_element ] ) ) {
    51055105                                $input_array = $input_array[ $path_element ];
    51065106                                continue;
    … …  
    51115111                         * which also checks for `null` values.
    51125112                         */
    5113                         if ( array_key_exists( $path_element, $input_array ) ) {
     5113                        if ( isset( $path_element ) && array_key_exists( $path_element, $input_array ) ) {
    51145114                                $input_array = $input_array[ $path_element ];
    51155115                                continue;
Note: See TracChangeset for help on using the changeset viewer.