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.

git-svn-id: https://develop.svn.wordpress.org/trunk@46148 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2019-09-16 09:57:30 +00:00
parent f360f879f8
commit ea350997e6

View File

@ -727,12 +727,12 @@ class wp_xmlrpc_server extends IXR_Server {
*
* @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.
* @return bool if `$args` contains at least $count arguments.
*/
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.' ) );
return false;
}