Make WordPress Core


Ignore:
Timestamp:
09/29/2025 04:28:00 PM (11 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/class-wp-hook.php

    r56609 r60809  
    8181         */
    8282        public function add_filter( $hook_name, $callback, $priority, $accepted_args ) {
     83                if ( null === $priority ) {
     84                        $priority = 0;
     85                }
     86
    8387                $idx = _wp_filter_build_unique_id( $hook_name, $callback, $priority );
    8488
     
    188192         */
    189193        public function remove_filter( $hook_name, $callback, $priority ) {
     194                if ( null === $priority ) {
     195                        $priority = 0;
     196                }
     197
    190198                $function_key = _wp_filter_build_unique_id( $hook_name, $callback, $priority );
    191199
    192                 $exists = isset( $this->callbacks[ $priority ][ $function_key ] );
     200                $exists = isset( $function_key, $this->callbacks[ $priority ][ $function_key ] );
    193201
    194202                if ( $exists ) {
Note: See TracChangeset for help on using the changeset viewer.