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.
Built from https://develop.svn.wordpress.org/trunk@46148


git-svn-id: http://core.svn.wordpress.org/trunk@45960 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2019-09-16 09:58:56 +00:00
parent 1060f7e167
commit dc305e9e0a
2 changed files with 4 additions and 4 deletions

View File

@ -727,12 +727,12 @@ class wp_xmlrpc_server extends IXR_Server {
* *
* @since 3.4.0 * @since 3.4.0
* *
* @param string|array $args Sanitize single string or array of strings. * @param array $args An array of arguments to check.
* @param int $count Minimum number of arguments. * @param int $count Minimum number of arguments.
* @return bool if `$args` contains at least $count arguments. * @return bool if `$args` contains at least $count arguments.
*/ */
protected function minimum_args( $args, $count ) { protected function minimum_args( $args, $count ) {
if ( count( $args ) < $count ) { if ( ! is_array( $args ) || count( $args ) < $count ) {
$this->error = new IXR_Error( 400, __( 'Insufficient arguments passed to this XML-RPC method.' ) ); $this->error = new IXR_Error( 400, __( 'Insufficient arguments passed to this XML-RPC method.' ) );
return false; return false;
} }

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.3-alpha-46147'; $wp_version = '5.3-alpha-46148';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.