Make WordPress Core

Changeset 62933


Ignore:
Timestamp:
07/29/2026 09:18:13 PM (3 months ago)
Author:
westonruter
Message:

XML-RPC: Pass the missing args to the enable_xmlrpc filters.

The option_{$option} filter has documented an $option parameter since 4.4.0, when r33738 added it, and pre_option_{$option} has documented both $option and, since 4.9.0, $default_value, added in r41013. However, WP_XMLRPC_Server::set_is_enabled() applies the enable_xmlrpc instances of these filters directly, in order to respect callbacks left over from before the option was deprecated in 3.5.0, and those calls were left passing only the value. A callback declaring the later parameters therefore raised an ArgumentCountError here, even though the very same callback works when the filter is reached through get_option().

The option name and the default are passed explicitly, since there is no $option variable in scope. The default matches what the filter would receive from get_option( 'enable_xmlrpc', false ).

Also add the standard reference comments pointing at the canonical docblocks in wp-includes/option.php.

These call sites were surfaced by the PHPStan extensions under development for this ticket, which are committed separately.

Developed as subset of ​https://github.com/WordPress/wordpress-develop/pull/12022.
Follow-up to r21804, r33738, r41013.

See #65376, #28402, #41254.

File:
1 edited

Legend:

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

    r62830 r62933  
    192192                 * option was deprecated in 3.5.0. Use the {@see 'xmlrpc_enabled'} hook instead.
    193193                 */
    194                 $is_enabled = apply_filters( 'pre_option_enable_xmlrpc', false );
     194                /** This filter is documented in wp-includes/option.php */
     195                $is_enabled = apply_filters( 'pre_option_enable_xmlrpc', false, 'enable_xmlrpc', false );
    195196                if ( false === $is_enabled ) {
    196                         $is_enabled = apply_filters( 'option_enable_xmlrpc', true );
     197                        /** This filter is documented in wp-includes/option.php */
     198                        $is_enabled = apply_filters( 'option_enable_xmlrpc', true, 'enable_xmlrpc' );
    197199                }
    198200
Note: See TracChangeset for help on using the changeset viewer.