WordPress.org

Make WordPress Core

Changeset 46148


Ignore:
Timestamp:
09/16/2019 09:57:30 AM (2 months ago)
Author:
SergeyBiryukov
Message:

XML-RPC: Avoid a PHP warning in wp_xmlrpc_server::minimum_args() if $args is not an array.

Correct the documentation to clarify that array is the only acceptable type for $args.

Props bitcomplex, dkarfa.
Fixes #48046.

File:
1 edited

Legend:

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

    r46144 r46148  
    728728     * @since 3.4.0
    729729     *
    730      * @param string|array $args Sanitize single string or array of strings.
    731      * @param int $count        Minimum number of arguments.
     730     * @param array $args  An array of arguments to check.
     731     * @param int   $count Minimum number of arguments.
    732732     * @return bool if `$args` contains at least $count arguments.
    733733     */
    734734    protected function minimum_args( $args, $count ) {
    735         if ( count( $args ) < $count ) {
     735        if ( ! is_array( $args ) || count( $args ) < $count ) {
    736736            $this->error = new IXR_Error( 400, __( 'Insufficient arguments passed to this XML-RPC method.' ) );
    737737            return false;
Note: See TracChangeset for help on using the changeset viewer.